aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Göffringmann2004-10-21 03:47:15 +0000
committerRobert Göffringmann2004-10-21 03:47:15 +0000
commite721c6de0c0f5f66beb9e602746d25713e0398f8 (patch)
tree2d424a56ce10f8297fe556e725df64dd2cb35a57
parente58a097acfd231f36eda89f76b385c7c13d58ded (diff)
downloadscummvm-rg350-e721c6de0c0f5f66beb9e602746d25713e0398f8.tar.gz
scummvm-rg350-e721c6de0c0f5f66beb9e602746d25713e0398f8.tar.bz2
scummvm-rg350-e721c6de0c0f5f66beb9e602746d25713e0398f8.zip
this should work around bug #922774.
well, at least it should keep the engine from crashing. svn-id: r15622
-rw-r--r--sword1/objectman.cpp6
-rw-r--r--sword1/objectman.h1
2 files changed, 6 insertions, 1 deletions
diff --git a/sword1/objectman.cpp b/sword1/objectman.cpp
index aa46b2d132..f9c392fe01 100644
--- a/sword1/objectman.cpp
+++ b/sword1/objectman.cpp
@@ -103,8 +103,10 @@ char *ObjectMan::lockText(uint32 textId) {
textId = 0; // get first line instead
}
uint32 offset = READ_LE_UINT32(addr + ((textId & ITM_ID) + 1)* 4);
- if (offset == 0)
+ if (offset == 0) {
warning("ObjectMan::lockText(%d): text number has no text lines", textId);
+ return _errorStr;
+ }
return addr + offset;
}
@@ -155,4 +157,6 @@ void ObjectMan::saveLiveList(uint16 *dest) {
memcpy(dest, _liveList, TOTAL_SECTIONS * sizeof(uint16));
}
+char *ObjectMan::_errorStr = "Error: Text not found.";
+
} // End of namespace Sword1
diff --git a/sword1/objectman.h b/sword1/objectman.h
index 3df047d379..63bf689c26 100644
--- a/sword1/objectman.h
+++ b/sword1/objectman.h
@@ -57,6 +57,7 @@ private:
static const uint32 _textList[TOTAL_SECTIONS][7]; //a table of pointers to text files
uint16 _liveList[TOTAL_SECTIONS]; //which sections are active
uint8 *_cptData[TOTAL_SECTIONS];
+ static char *_errorStr;
};
} // End of namespace Sword1