[Scummvm-git-logs] scummvm master -> b1950ac1b7778ea380f73255587b382ad2bccad6
AndywinXp
noreply at scummvm.org
Tue Oct 10 19:49:23 UTC 2023
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:
b1950ac1b7 SWORD1: Avoid nullptr access
Commit: b1950ac1b7778ea380f73255587b382ad2bccad6
https://github.com/scummvm/scummvm/commit/b1950ac1b7778ea380f73255587b382ad2bccad6
Author: AndywinXp (andywinxp at gmail.com)
Date: 2023-10-10T21:49:16+02:00
Commit Message:
SWORD1: Avoid nullptr access
Changed paths:
engines/sword1/menu.cpp
diff --git a/engines/sword1/menu.cpp b/engines/sword1/menu.cpp
index 4b3bfb1fe26..620cca98e0f 100644
--- a/engines/sword1/menu.cpp
+++ b/engines/sword1/menu.cpp
@@ -155,7 +155,7 @@ uint8 Menu::checkMenuClick(uint8 menuType) {
}
} else if (mouseEvent & BS1L_BUTTON_DOWN) {
for (uint8 cnt = 0; cnt < Logic::_scriptVars[IN_SUBJECT]; cnt++) {
- if (_subjects[cnt]->wasClicked(x, y)) {
+ if (_subjects[cnt] && _subjects[cnt]->wasClicked(x, y)) {
Logic::_scriptVars[OBJECT_HELD] = _subjectBar[cnt];
refreshMenus();
break;
@@ -170,7 +170,7 @@ uint8 Menu::checkMenuClick(uint8 menuType) {
}
} else if (mouseEvent & BS1L_BUTTON_DOWN) {
for (uint8 cnt = 0; cnt < _inMenu; cnt++) {
- if (_objects[cnt]->wasClicked(x, y)) {
+ if (_objects[cnt] && _objects[cnt]->wasClicked(x, y)) {
Logic::_scriptVars[OBJECT_HELD] = _menuList[cnt];
refreshMenus();
break;
@@ -182,7 +182,7 @@ uint8 Menu::checkMenuClick(uint8 menuType) {
// Normal use, i.e. inventory. Things happen on mouse-down.
if (menuType == MENU_TOP) {
for (uint8 cnt = 0; cnt < _inMenu; cnt++) {
- if (_objects[cnt]->wasClicked(x, y)) {
+ if (_objects[cnt] && _objects[cnt]->wasClicked(x, y)) {
if (mouseEvent & BS1R_BUTTON_DOWN) { // looking at item
Logic::_scriptVars[OBJECT_HELD] = _menuList[cnt];
Logic::_scriptVars[MENU_LOOKING] = 1;
More information about the Scummvm-git-logs
mailing list