[Scummvm-git-logs] scummvm master -> 2c466952d9256cbdef3b700ff79a557e9595a37c

rvanlaar noreply at scummvm.org
Mon Sep 26 10:36:36 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2c466952d9 DIRECTOR: Simplify opening stream Cast::loadConfig


Commit: 2c466952d9256cbdef3b700ff79a557e9595a37c
    https://github.com/scummvm/scummvm/commit/2c466952d9256cbdef3b700ff79a557e9595a37c
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-09-26T12:32:09+02:00

Commit Message:
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

Changed paths:
    engines/director/cast.cpp


diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 85ef1ff0cb5..d2bd6cce9c8 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -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))




More information about the Scummvm-git-logs mailing list