diff options
-rw-r--r-- | engines/sword25/script/luabindhelper.cpp | 4 |
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) |