aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
authorFilippos Karapetis2007-07-09 17:39:47 +0000
committerFilippos Karapetis2007-07-09 17:39:47 +0000
commit11b43f877d47965773fa9b0f7127cc22f7000db6 (patch)
treeb3f53f4be9a2bd9e2a5e60b0198adb9fdecadb15 /engines/agi
parente10a6e65155deb86812aae4a89190c652b237f4f (diff)
downloadscummvm-rg350-11b43f877d47965773fa9b0f7127cc22f7000db6.tar.gz
scummvm-rg350-11b43f877d47965773fa9b0f7127cc22f7000db6.tar.bz2
scummvm-rg350-11b43f877d47965773fa9b0f7127cc22f7000db6.zip
Fix for bug #1742432 - AGI: Engine crashes if no game is detected
svn-id: r27993
Diffstat (limited to 'engines/agi')
-rw-r--r--engines/agi/agi.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index 0839b7de99..61430dcaea 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -676,6 +676,13 @@ void AgiEngine::initialize() {
}
AgiEngine::~AgiEngine() {
+ // If the engine hasn't been initialized yet via AgiEngine::initialize(), don't attempt to free any resources,
+ // as they haven't been allocated. Fixes bug #1742432 - AGI: Engine crashes if no game is detected
+ if (_game.state == STATE_INIT) {
+ delete _rnd; // delete _rnd, as it is allocated in the constructor, not in initialize()
+ return;
+ }
+
agiDeinit();
_sound->deinitSound();
delete _sound;