diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/agi/agi.cpp | 7 |
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; |