[Scummvm-git-logs] scummvm master -> 53f262df50c3959c969b8644cf4c4d99fe910fa4

Strangerke noreply at scummvm.org
Sat May 18 08:51:10 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:
53f262df50 BAGEL: In SBarSlotWnd, add some variable initialization, fix null dereferencing (CID 1544829, 1544880)


Commit: 53f262df50c3959c969b8644cf4c4d99fe910fa4
    https://github.com/scummvm/scummvm/commit/53f262df50c3959c969b8644cf4c4d99fe910fa4
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-05-18T09:51:04+01:00

Commit Message:
BAGEL: In SBarSlotWnd, add some variable initialization, fix null dereferencing (CID 1544829, 1544880)

Changed paths:
    engines/bagel/spacebar/slot_wnd.cpp


diff --git a/engines/bagel/spacebar/slot_wnd.cpp b/engines/bagel/spacebar/slot_wnd.cpp
index 80bfd505340..a8f62108ac0 100644
--- a/engines/bagel/spacebar/slot_wnd.cpp
+++ b/engines/bagel/spacebar/slot_wnd.cpp
@@ -119,7 +119,10 @@ SBarSlotWnd::SBarSlotWnd() : CBagStorageDevWnd() {
 	_pWinSound = nullptr;
 	_pSlotSound = nullptr;
 	_pLoseBmp = nullptr;
-
+	_pBkgSnd = nullptr;
+	_bPaused = false;
+	_bLose = false;
+	
 	CBagStorageDevWnd::setHelpFilename(BuildSlotDir("SLOT.TXT"));
 
 	// Call this thing a closeup so that time won't go
@@ -303,18 +306,14 @@ ErrorCode SBarSlotWnd::detach() {
 	if (pVar)
 		pVar->setValue(_nCredit);
 
-	if (_pBkgSnd->isPlaying()) {
+	if (_pBkgSnd != nullptr && _pBkgSnd->isPlaying())
 		_pBkgSnd->stop();
-	}
-	if (_pBkgSnd != nullptr) {
-		delete _pBkgSnd;
-		_pBkgSnd = nullptr;
-	}
 
-	if (_pLoseBmp != nullptr) {
-		delete _pLoseBmp;
-		_pLoseBmp = nullptr;
-	}
+	delete _pBkgSnd;
+	_pBkgSnd = nullptr;
+
+	delete _pLoseBmp;
+	_pLoseBmp = nullptr;
 
 	// Destroy all buttons
 	for (int i = 0; i < NUM_SLOTBUTT; i++) {




More information about the Scummvm-git-logs mailing list