[Scummvm-git-logs] scummvm master -> 8a55637a3e13e7cfa0cdd2d0813d3693a6947691

Strangerke noreply at scummvm.org
Wed May 8 06:56:01 UTC 2024


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:
8a55637a3e BAGEL: Avoid 4 potential null dereferencing in CBagRPObject (CID 1544837, 1544855, 1544857, 1544899)


Commit: 8a55637a3e13e7cfa0cdd2d0813d3693a6947691
    https://github.com/scummvm/scummvm/commit/8a55637a3e13e7cfa0cdd2d0813d3693a6947691
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-05-08T07:55:53+01:00

Commit Message:
BAGEL: Avoid 4 potential null dereferencing in CBagRPObject (CID 1544837, 1544855, 1544857, 1544899)

Changed paths:
    engines/bagel/baglib/rp_object.cpp


diff --git a/engines/bagel/baglib/rp_object.cpp b/engines/bagel/baglib/rp_object.cpp
index 157a4e03e9b..0351806831a 100644
--- a/engines/bagel/baglib/rp_object.cpp
+++ b/engines/bagel/baglib/rp_object.cpp
@@ -1202,12 +1202,13 @@ void CBagRPObject::saveResiduePrintedVars() {
 		}
 	}
 
-	// Now handle touched dossier's
-	int nCount = _pTouchedList->getCount();
-	assert(nCount <= 3);
 	DossierObj *pDosObj;
 
 	if (_pTouchedList) {
+		// Now handle touched dossier's
+		int nCount = _pTouchedList->getCount();
+		assert(nCount <= 3);
+
 		for (int i = 0; i < nCount; i++) {
 			pDosObj = _pTouchedList->getNodeItem(i);
 			switch (i) {
@@ -1224,11 +1225,11 @@ void CBagRPObject::saveResiduePrintedVars() {
 		}
 	}
 
-	// Now handle untouched dossier's
-	nCount = _pUntouchedList->getCount();
-	assert(nCount <= 3);
-
 	if (_pUntouchedList) {
+		// Now handle untouched dossier's
+		int nCount = _pUntouchedList->getCount();
+		assert(nCount <= 3);
+
 		for (int i = 0; i < nCount; i++) {
 			pDosObj = _pUntouchedList->getNodeItem(i);
 			switch (i) {
@@ -1288,12 +1289,13 @@ void CBagRPObject::restoreResiduePrintedVars() {
 		}
 	}
 
-	// Now handle touched dossier's
-	int nCount = _pTouchedList->getCount();
-	assert(nCount <= 3);
 	DossierObj *pDosObj;
 
 	if (_pTouchedList) {
+		// Now handle touched dossier's
+		int nCount = _pTouchedList->getCount();
+		assert(nCount <= 3);
+
 		for (int i = 0; i < nCount; i++) {
 			pDosObj = _pTouchedList->getNodeItem(i);
 			switch (i) {
@@ -1310,11 +1312,11 @@ void CBagRPObject::restoreResiduePrintedVars() {
 		}
 	}
 
-	// Now handle untouched dossier's
-	nCount = _pUntouchedList->getCount();
-	assert(nCount <= 3);
-
 	if (_pUntouchedList) {
+		// Now handle untouched dossier's
+		int nCount = _pUntouchedList->getCount();
+		assert(nCount <= 3);
+
 		for (int i = 0; i < nCount; i++) {
 			pDosObj = _pUntouchedList->getNodeItem(i);
 			switch (i) {




More information about the Scummvm-git-logs mailing list