DIRECTOR: Simplify opening stream Cast::loadConfig

Remove check if resource exists in the stream when loading a cast.
This check is already executed by `Archive::getMovieResourceIfPresent`.

Coverity found this as a Deference null return value due to not
checking if the stream was not a nullptr.

Fixes COVERITY: 1491676
This commit is contained in:
Roland van Laar 2022-09-26 12:32:09 +02:00
parent 3520f7a26f
commit 2c466952d9

View File

@ -229,15 +229,13 @@ void Cast::loadArchive() {
}
bool Cast::loadConfig() {
if (!_castArchive->hasResource(MKTAG('V', 'W', 'C', 'F'), -1)) {
Common::SeekableReadStreamEndian *stream = nullptr;
stream = _castArchive->getMovieResourceIfPresent(MKTAG('V', 'W', 'C', 'F'));
if (!stream) {
warning("Cast::loadConfig(): Wrong format. VWCF resource missing");
return false;
}
Common::SeekableReadStreamEndian *stream = nullptr;
stream = _castArchive->getMovieResourceIfPresent(MKTAG('V', 'W', 'C', 'F'));
debugC(1, kDebugLoading, "****** Loading Config VWCF");
if (debugChannelSet(5, kDebugLoading))