[Scummvm-git-logs] scummvm master -> 9a3dd02b56e71cf21401183ed4dc0be8e094ae01
Strangerke
noreply at scummvm.org
Sat May 18 08:44:50 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:
9a3dd02b56 BAGEL: Fix null dereferencing in CMainWindow (CID 1544851, 1544860, 1544882)
Commit: 9a3dd02b56e71cf21401183ed4dc0be8e094ae01
https://github.com/scummvm/scummvm/commit/9a3dd02b56e71cf21401183ed4dc0be8e094ae01
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-05-18T09:44:44+01:00
Commit Message:
BAGEL: Fix null dereferencing in CMainWindow (CID 1544851, 1544860, 1544882)
Changed paths:
engines/bagel/spacebar/main_window.cpp
diff --git a/engines/bagel/spacebar/main_window.cpp b/engines/bagel/spacebar/main_window.cpp
index f24105d5465..db4a5f1a392 100644
--- a/engines/bagel/spacebar/main_window.cpp
+++ b/engines/bagel/spacebar/main_window.cpp
@@ -149,24 +149,22 @@ ErrorCode CMainWindow::attach() {
if (!_pWieldBmp) {
pSDev = g_SDevManager->getStorageDevice(WIELD_WLD);
- if (pSDev != nullptr) {
- _pWieldBmp = (CBagWield *)pSDev;
- _pWieldBmp->setAssociateWnd(this);
- if (!_pWieldBmp->isAttached())
- _pWieldBmp->attach();
-
- if (_pWieldBmp->getRect().isRectEmpty()) {
- CBofRect r(0, 380, 0 + 100 - 1, 380 + 100 - 1);
- _pWieldBmp->setRect(r);
- r = getClientRect();
- }
+ if (pSDev == nullptr)
+ fatalError(ERR_UNKNOWN, "No Wield found");
- insertFGObjects(_pWieldBmp);
- _pWieldBmp->setVisible(true);
+ _pWieldBmp = (CBagWield *)pSDev;
+ _pWieldBmp->setAssociateWnd(this);
+ if (!_pWieldBmp->isAttached())
+ _pWieldBmp->attach();
- } else {
- reportError(ERR_UNKNOWN, "No Wield found");
+ if (_pWieldBmp->getRect().isRectEmpty()) {
+ CBofRect r(0, 380, 0 + 100 - 1, 380 + 100 - 1);
+ _pWieldBmp->setRect(r);
+ r = getClientRect();
}
+
+ insertFGObjects(_pWieldBmp);
+ _pWieldBmp->setVisible(true);
}
if ((CBagObject *)nullptr == getFGObjects(CBofString(WIELD_WLD))) {
@@ -177,31 +175,29 @@ ErrorCode CMainWindow::attach() {
// Create the PDA for the game
if (!_pPDABmp) {
pSDev = g_SDevManager->getStorageDevice(PDA_WLD);
- if (pSDev != nullptr) {
- _pPDABmp = (CBagPDA *)pSDev;
- CBofRect r(0, 0, 300, 200);
- _pPDABmp->setAssociateWnd(this);
- _pPDABmp->setRect(r);
- r = getClientRect();
- if (!_pPDABmp->isAttached())
- _pPDABmp->attach();
-
- // Allow the script to specify the increment height.
- CBagVar *pVar = g_VarManager->getVariable("PDAINCREMENT");
- if (pVar) {
- g_nPDAIncrement = pVar->getNumValue();
- _pPDABmp->setPosInWindow(r.width(), r.height(), g_nPDAIncrement);
- } else {
- g_nPDAIncrement = PDA_INCREMENT;
- _pPDABmp->setPosInWindow(r.width(), r.height(), g_nPDAIncrement);
- }
- insertFGObjects(_pPDABmp);
- deactivatePDA();
- _pPDABmp->setVisible(true);
+ if (pSDev == nullptr)
+ fatalError(ERR_UNKNOWN, "No PDA found");
+ _pPDABmp = (CBagPDA *)pSDev;
+ CBofRect r(0, 0, 300, 200);
+ _pPDABmp->setAssociateWnd(this);
+ _pPDABmp->setRect(r);
+ r = getClientRect();
+ if (!_pPDABmp->isAttached())
+ _pPDABmp->attach();
+
+ // Allow the script to specify the increment height.
+ CBagVar *pVar = g_VarManager->getVariable("PDAINCREMENT");
+ if (pVar) {
+ g_nPDAIncrement = pVar->getNumValue();
+ _pPDABmp->setPosInWindow(r.width(), r.height(), g_nPDAIncrement);
} else {
- reportError(ERR_UNKNOWN, "No PDA found");
+ g_nPDAIncrement = PDA_INCREMENT;
+ _pPDABmp->setPosInWindow(r.width(), r.height(), g_nPDAIncrement);
}
+ insertFGObjects(_pPDABmp);
+ deactivatePDA();
+ _pPDABmp->setVisible(true);
}
if ((CBagObject *)nullptr == getFGObjects(CBofString(PDA_WLD))) {
@@ -281,10 +277,15 @@ ErrorCode CMainWindow::attach() {
case 3:
_pBackdrop->fadeLines(this);
break;
+
+ default:
+ break;
}
}
- _pBackdrop->paint(this, 0, 0);
+ if (_pBackdrop != nullptr)
+ _pBackdrop->paint(this, 0, 0);
+
return _errCode;
}
More information about the Scummvm-git-logs
mailing list