[Scummvm-git-logs] scummvm master -> 87dafae34d2d1bcfd6e2512c8db37fffb22fbdd2

Strangerke noreply at scummvm.org
Tue May 21 17:33:30 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:
87dafae34d BAGEL: Fix some PVS Studio issues


Commit: 87dafae34d2d1bcfd6e2512c8db37fffb22fbdd2
    https://github.com/scummvm/scummvm/commit/87dafae34d2d1bcfd6e2512c8db37fffb22fbdd2
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-05-21T18:33:22+01:00

Commit Message:
BAGEL: Fix some PVS Studio issues

Changed paths:
    engines/bagel/baglib/master_win.h
    engines/bagel/dialogs/quit_dialog.cpp
    engines/bagel/dialogs/restart_dialog.cpp
    engines/bagel/dialogs/restore_dialog.cpp
    engines/bagel/dialogs/restore_dialog.h
    engines/bagel/dialogs/save_dialog.h


diff --git a/engines/bagel/baglib/master_win.h b/engines/bagel/baglib/master_win.h
index 3fed811bd52..fc424e01067 100644
--- a/engines/bagel/baglib/master_win.h
+++ b/engines/bagel/baglib/master_win.h
@@ -31,6 +31,7 @@
 #include "bagel/boflib/sound.h"
 #include "bagel/baglib/object.h"
 #include "bagel/dialogs/save_dialog.h"
+#include "bagel/baglib/save_game_file.h"
 #include "bagel/baglib/var.h"
 
 namespace Bagel {
diff --git a/engines/bagel/dialogs/quit_dialog.cpp b/engines/bagel/dialogs/quit_dialog.cpp
index ad0c4912c61..5c2da02b3ec 100644
--- a/engines/bagel/dialogs/quit_dialog.cpp
+++ b/engines/bagel/dialogs/quit_dialog.cpp
@@ -63,15 +63,15 @@ void CBagQuitDialog::onInitDialog() {
 	CBofDialog::onInitDialog();
 	setReturnValue(-1);
 
-	assert(_pBackdrop != nullptr);
+	if (_pBackdrop == nullptr)
+		fatalError(ERR_UNKNOWN, "Unexpected null value found in _paBackdrop");
+
 	CBofPalette *pPal = _pBackdrop->getPalette();
 	selectPalette(pPal);
 
 	// Paint the SaveList Box onto the background
-	if (_pBackdrop != nullptr) {
-		CBofBitmap cBmp(buildSysDir("QUITDBOX.BMP"), pPal);
-		cBmp.paint(_pBackdrop, 205, 150);
-	}
+	CBofBitmap cBmp(buildSysDir("QUITDBOX.BMP"), pPal);
+	cBmp.paint(_pBackdrop, 205, 150);
 
 	// Build all our buttons
 	for (int i = 0; i < NUM_QUIT_BUTTONS; i++) {
diff --git a/engines/bagel/dialogs/restart_dialog.cpp b/engines/bagel/dialogs/restart_dialog.cpp
index f141371c9d4..f2256ae29f2 100644
--- a/engines/bagel/dialogs/restart_dialog.cpp
+++ b/engines/bagel/dialogs/restart_dialog.cpp
@@ -67,8 +67,9 @@ void CBagRestartDialog::onInitDialog() {
 
 	CBofDialog::onInitDialog();
 
-	assert(_pBackdrop != nullptr);
-
+	if (_pBackdrop == nullptr)
+		fatalError(ERR_UNKNOWN, "Unexpected null value found in _paBackdrop");
+	
 	// Save off the current game's palette
 	_pSavePalette = CBofApp::getApp()->getPalette();
 
@@ -77,11 +78,9 @@ void CBagRestartDialog::onInitDialog() {
 	CBofApp::getApp()->setPalette(pPal);
 
 	// Paint the SaveList Box onto the background
-	if (_pBackdrop != nullptr) {
-		pPal = _pBackdrop->getPalette();
-		CBofBitmap cBmp(buildSysDir("RESTDBOX.BMP"), pPal);
-		cBmp.paint(_pBackdrop, 181, 182);
-	}
+	pPal = _pBackdrop->getPalette();
+	CBofBitmap cBmp(buildSysDir("RESTDBOX.BMP"), pPal);
+	cBmp.paint(_pBackdrop, 181, 182);
 
 	// Build all our buttons
 	for (int i = 0; i < NUM_RESTART_BTNS; i++) {
diff --git a/engines/bagel/dialogs/restore_dialog.cpp b/engines/bagel/dialogs/restore_dialog.cpp
index fc6b601a3c3..31973c3c985 100644
--- a/engines/bagel/dialogs/restore_dialog.cpp
+++ b/engines/bagel/dialogs/restore_dialog.cpp
@@ -147,7 +147,8 @@ ErrorCode CBagRestoreDialog::attach() {
 	}
 
 	// The list box must not be currently allocated
-	assert(_pListBox == nullptr);
+	if (_pListBox == nullptr)
+		fatalError(ERR_UNKNOWN, "Unexpected null value found in _pListBox");
 
 	// Create a list box for the user to choose the slot to save into
 	CBofRect cRect(LIST_X, LIST_Y, LIST_X + LIST_DX - 1, LIST_Y + LIST_DY - 1);
diff --git a/engines/bagel/dialogs/restore_dialog.h b/engines/bagel/dialogs/restore_dialog.h
index deaed0f95f2..2496de437d8 100644
--- a/engines/bagel/dialogs/restore_dialog.h
+++ b/engines/bagel/dialogs/restore_dialog.h
@@ -23,11 +23,11 @@
 #ifndef BAGEL_DIALOGS_RESTORE_DIALOG_H
 #define BAGEL_DIALOGS_RESTORE_DIALOG_H
 
+#include "bagel/bagel.h"
 #include "bagel/boflib/gui/list_box.h"
 #include "bagel/boflib/gui/scroll_bar.h"
 #include "bagel/boflib/gui/button.h"
 #include "bagel/boflib/gui/text_box.h"
-#include "bagel/boflib/string.h"
 #include "bagel/dialogs/save_dialog.h"
 
 namespace Bagel {
diff --git a/engines/bagel/dialogs/save_dialog.h b/engines/bagel/dialogs/save_dialog.h
index 9443a08ba0d..f871ceba996 100644
--- a/engines/bagel/dialogs/save_dialog.h
+++ b/engines/bagel/dialogs/save_dialog.h
@@ -23,7 +23,6 @@
 #ifndef BAGEL_DIALOGS_SAVE_DIALOG_H
 #define BAGEL_DIALOGS_SAVE_DIALOG_H
 
-#include "bagel/baglib/save_game_file.h"
 #include "bagel/boflib/gui/dialog.h"
 #include "bagel/boflib/gui/list_box.h"
 #include "bagel/boflib/gui/scroll_bar.h"




More information about the Scummvm-git-logs mailing list