diff options
author | Paweł Kołodziejski | 2009-02-17 21:18:11 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2009-02-17 21:18:11 +0000 |
commit | 83656cc9ad8230b530d49fd122c605b1aa612c30 (patch) | |
tree | 603548ba7f79cd88fcb2d071cda00d84f1b9159b | |
parent | fc34cb3bd38dd46acc606cbe290cd851cf57b171 (diff) | |
download | scummvm-rg350-83656cc9ad8230b530d49fd122c605b1aa612c30.tar.gz scummvm-rg350-83656cc9ad8230b530d49fd122c605b1aa612c30.tar.bz2 scummvm-rg350-83656cc9ad8230b530d49fd122c605b1aa612c30.zip |
don't attempt display resource type name if it's out of array, so it give access violation
svn-id: r38449
-rw-r--r-- | engines/sci/scicore/resource.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/engines/sci/scicore/resource.cpp b/engines/sci/scicore/resource.cpp index ae822f3f6a..a1e9f79eae 100644 --- a/engines/sci/scicore/resource.cpp +++ b/engines/sci/scicore/resource.cpp @@ -25,6 +25,8 @@ /* Resource library */ +#include "common/util.h" + #include "sci/include/sci_memory.h" #include "sci/include/sciresource.h" #include "sci/include/vocabulary.h" /* For SCI version auto-detection */ @@ -883,9 +885,10 @@ scir_find_resource(resource_mgr_t *mgr, int type, int number, int lock) { void scir_unlock_resource(resource_mgr_t *mgr, resource_t *res, int resnum, int restype) { if (!res) { - sciprintf("Resmgr: Warning: Attempt to unlock non-existant" - " resource %s.%03d!\n", - sci_resource_types[restype], resnum); + if (restype >= ARRAYSIZE(sci_resource_types)) + sciprintf("Resmgr: Warning: Attempt to unlock non-existant resource %03d.%03d!\n", restype, resnum); + else + sciprintf("Resmgr: Warning: Attempt to unlock non-existant resource %s.%03d!\n", sci_resource_types[restype], resnum); return; } |