Skip to content

Commit

Permalink
SCI: Fix Segfault When Using Console "show_map" Command on SCI32 games.
Browse files Browse the repository at this point in the history
The _gfxScreen instance is nullptr for SCI32 games, thus this console
command previously caused a segfault.
  • Loading branch information
digitall committed Oct 18, 2018
1 parent c7fc6bb commit 9173223
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion engines/sci/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2568,14 +2568,23 @@ bool Console::cmdShowMap(int argc, const char **argv) {
return true;
}

#ifdef ENABLE_SCI32
if (getSciVersion() >= SCI_VERSION_2) {
debugPrintf("Command not available / implemented for SCI32 games.\n");
return true;
}
#endif

int map = atoi(argv[1]);

switch (map) {
case 0:
case 1:
case 2:
case 3:
_engine->_gfxScreen->debugShowMap(map);
if (_engine->_gfxScreen) {
_engine->_gfxScreen->debugShowMap(map);
}
break;

default:
Expand Down

0 comments on commit 9173223

Please sign in to comment.