[Scummvm-git-logs] scummvm master -> 5d88aa79a8d310a81a5225a316ab7a774fe2304f

Strangerke noreply at scummvm.org
Sat May 11 22:24:07 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:
5d88aa79a8 BAGEL: Initialize variable in list_box(CID 1544877), remove some useless null checks before delete, move assignments out


Commit: 5d88aa79a8d310a81a5225a316ab7a774fe2304f
    https://github.com/scummvm/scummvm/commit/5d88aa79a8d310a81a5225a316ab7a774fe2304f
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-05-11T23:24:00+01:00

Commit Message:
BAGEL: Initialize variable in list_box(CID 1544877), remove some useless null checks before delete, move assignments out of if statements

Changed paths:
    engines/bagel/boflib/gui/list_box.cpp


diff --git a/engines/bagel/boflib/gui/list_box.cpp b/engines/bagel/boflib/gui/list_box.cpp
index b2a37bac072..c8bdf20d1d5 100644
--- a/engines/bagel/boflib/gui/list_box.cpp
+++ b/engines/bagel/boflib/gui/list_box.cpp
@@ -43,18 +43,17 @@ CBofListBox::CBofListBox() {
 	_pWork = nullptr;
 	_nItemHeight = TEXT_ITEM_HEIGHT;
 	_nState = LISTBOX_NORMAL;
+	_nTextFont = FONT_DEFAULT;
 
 	// Initialized the selected item
-	clearSelection();
+	CBofListBox::clearSelection();
 }
 
 
 CBofListBox::~CBofListBox() {
 	// Kill the temporary work area
-	if (_pWork != nullptr) {
-		delete _pWork;
-		_pWork  = nullptr;
-	}
+	delete _pWork;
+	_pWork  = nullptr;
 
 	deleteAll(false);
 }
@@ -328,10 +327,8 @@ void CBofListBox::onPaint(CBofRect * /*pRect*/) {
 void CBofListBox::killBackground() {
 	assert(isValidObject(this));
 
-	if (_pBackdrop != nullptr) {
-		delete _pBackdrop;
-		_pBackdrop = nullptr;
-	}
+	delete _pBackdrop;
+	_pBackdrop = nullptr;
 }
 
 
@@ -339,8 +336,8 @@ ErrorCode CBofListBox::saveBackground() {
 	assert(isValidObject(this));
 
 	killBackground();
-
-	if ((_pBackdrop = new CBofBitmap(width(), height(), CBofApp::getApp()->getPalette())) != nullptr) {
+	_pBackdrop = new CBofBitmap(width(), height(), CBofApp::getApp()->getPalette());
+	if (_pBackdrop != nullptr) {
 		if ((_parent != nullptr) && (_parent->getBackdrop() != nullptr)) {
 			CBofRect cRect = _pBackdrop->getRect();
 
@@ -366,8 +363,8 @@ ErrorCode CBofListBox::createWorkArea() {
 
 	if (_pWork == nullptr) {
 		assert(_pBackdrop != nullptr);
-
-		if ((_pWork = new CBofBitmap(width(), height(), _pBackdrop->getPalette())) == nullptr) {
+		_pWork = new CBofBitmap(width(), height(), _pBackdrop->getPalette());
+		if (_pWork == nullptr) {
 			reportError(ERR_MEMORY, "Unable to allocate a %d x %d CBofBitmap", width(), height());
 		}
 	}




More information about the Scummvm-git-logs mailing list