diff options
author | Travis Howell | 2007-06-06 05:54:03 +0000 |
---|---|---|
committer | Travis Howell | 2007-06-06 05:54:03 +0000 |
commit | 0a7c2b66b30c11cd198c5d712103bc8ee995b945 (patch) | |
tree | 3656d0ce73d16780d7fd083a316da57d82e6a41c /engines | |
parent | c8259673b7753b288a4ccb391f7435942d741b6c (diff) | |
download | scummvm-rg350-0a7c2b66b30c11cd198c5d712103bc8ee995b945.tar.gz scummvm-rg350-0a7c2b66b30c11cd198c5d712103bc8ee995b945.tar.bz2 scummvm-rg350-0a7c2b66b30c11cd198c5d712103bc8ee995b945.zip |
Fix crash, when the hitarea array overflows in the Amiga demo of Elvira 1.
svn-id: r27128
Diffstat (limited to 'engines')
-rw-r--r-- | engines/agos/verb.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/engines/agos/verb.cpp b/engines/agos/verb.cpp index 27c5b4012e..ff57ba84b4 100644 --- a/engines/agos/verb.cpp +++ b/engines/agos/verb.cpp @@ -391,13 +391,15 @@ HitArea *AGOSEngine::findBox(uint hitarea_id) { HitArea *AGOSEngine::findEmptyHitArea() { HitArea *ha = _hitAreas; - uint count = ARRAYSIZE(_hitAreas); + uint count = ARRAYSIZE(_hitAreas) - 1; do { if (ha->flags == 0) return ha; } while (ha++, --count); - return NULL; + + // The last box is overwritten, if too many boxes are allocated. + return ha; } void AGOSEngine::freeBox(uint index) { |