[Scummvm-git-logs] scummvm master -> 4514cc67aa48b3223f615f26769a6cce6860163c

Strangerke noreply at scummvm.org
Sat May 18 12:48: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:
4514cc67aa BAGEL: Fix some pvs-studio issues in CBagButtonObject


Commit: 4514cc67aa48b3223f615f26769a6cce6860163c
    https://github.com/scummvm/scummvm/commit/4514cc67aa48b3223f615f26769a6cce6860163c
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-05-18T13:48:22+01:00

Commit Message:
BAGEL: Fix some pvs-studio issues in CBagButtonObject

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


diff --git a/engines/bagel/baglib/button_object.cpp b/engines/bagel/baglib/button_object.cpp
index e0abf1a9622..02650baeddf 100644
--- a/engines/bagel/baglib/button_object.cpp
+++ b/engines/bagel/baglib/button_object.cpp
@@ -52,8 +52,9 @@ CBagButtonObject::~CBagButtonObject() {
 ErrorCode CBagButtonObject::attach() {
 	ErrorCode errorCode = CBagSpriteObject::attach();
 
-	if (getSprite()) {
-		getSprite()->setAnimated(false);
+	CBofSprite *curSprite = getSprite();
+	if (curSprite) {
+		curSprite->setAnimated(false);
 	}
 
 	if (_buttonType == BTN_VLEVER || _buttonType == BTN_HLEVER) {
@@ -61,7 +62,7 @@ ErrorCode CBagButtonObject::attach() {
 		_midPoint.y = getRect().topLeft().y + (getRect().height() / 2);
 	}
 
-	if (getSprite()->getCelCount() == 1 && _buttonType != BTN_SLIDER) {
+	if (curSprite && curSprite->getCelCount() == 1 && _buttonType != BTN_SLIDER) {
 		// Only given down state
 		setVisible(false);
 	}
@@ -464,7 +465,7 @@ void CBagButtonObject::setProperty(const CBofString &prop, int val) {
 				else
 					_activeDown = true;
 
-				if (getSprite() && (getSprite()->getCelCount() == 1)) { // Only given down state
+				if (getSprite()->getCelCount() == 1) { // Only given down state
 					setVisible(_activeDown);
 					_active = false;
 				}




More information about the Scummvm-git-logs mailing list