aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/script/luabindhelper.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2010-08-14 22:27:59 +0000
committerEugene Sandulenko2010-10-12 22:45:32 +0000
commit06fc35ffe874b3dad16804f5827b5e5845444889 (patch)
tree9c22c2b1ee12cad6cbaa42b9895abd57e28cea31 /engines/sword25/script/luabindhelper.cpp
parent4b1b3e5034485b3ffdadaf1a1784a9d8b532c511 (diff)
downloadscummvm-rg350-06fc35ffe874b3dad16804f5827b5e5845444889.tar.gz
scummvm-rg350-06fc35ffe874b3dad16804f5827b5e5845444889.tar.bz2
scummvm-rg350-06fc35ffe874b3dad16804f5827b5e5845444889.zip
SWORD25: Make Lua package registering more robust.
svn-id: r53242
Diffstat (limited to 'engines/sword25/script/luabindhelper.cpp')
-rw-r--r--engines/sword25/script/luabindhelper.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/engines/sword25/script/luabindhelper.cpp b/engines/sword25/script/luabindhelper.cpp
index cca642de63..f45a6c24f4 100644
--- a/engines/sword25/script/luabindhelper.cpp
+++ b/engines/sword25/script/luabindhelper.cpp
@@ -325,11 +325,11 @@ bool BS_LuaBindhelper::GetMetatable(lua_State *L, const Common::String &TableNam
bool BS_LuaBindhelper::_CreateTable(lua_State *L, const Common::String &TableName) {
const char *PartBegin = TableName.c_str();
- while (*PartBegin) {
+ while (PartBegin - TableName.c_str() < (int)TableName.size()) {
const char *PartEnd = strchr(PartBegin, '.');
if (!PartEnd)
PartEnd = PartBegin + strlen(PartBegin);
- Common::String SubTableName(PartBegin, PartEnd - PartBegin);
+ Common::String SubTableName(PartBegin, PartEnd);
// Tables with an empty string as the name are not allowed
if (SubTableName.size() == 0)