diff options
author | Philipp Sehmisch <mana@crushnet.org> | 2010-01-16 16:42:36 +0100 |
---|---|---|
committer | Philipp Sehmisch <mana@crushnet.org> | 2010-01-16 16:42:36 +0100 |
commit | 8bf0791932c8809fe5bd85d53859b8ce6197e4ed (patch) | |
tree | 21406f25800f2387ad5abdcdf697bc8d736c0610 /src | |
parent | 4544e23b23fd722aeeeb99f37c7076e09cc037bb (diff) | |
download | manaserv-8bf0791932c8809fe5bd85d53859b8ce6197e4ed.tar.gz manaserv-8bf0791932c8809fe5bd85d53859b8ce6197e4ed.tar.bz2 manaserv-8bf0791932c8809fe5bd85d53859b8ce6197e4ed.tar.xz manaserv-8bf0791932c8809fe5bd85d53859b8ce6197e4ed.zip |
Prevented segmentation fault when calling the lua set_quest_var function with an illegal character handle.
Diffstat (limited to 'src')
-rw-r--r-- | src/scripting/lua.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index 3b33a3d1..5813836e 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -925,11 +925,16 @@ static int chr_set_quest(lua_State *s) Character *q = getCharacter(s, 1); const char *m = lua_tostring(s, 2); const char *n = lua_tostring(s, 3); - if (!m || !n || m[0] == 0) + if (!m || !n || m[0] == 0 || strlen(m) == 0) { raiseScriptError(s, "chr_set_quest called with incorrect parameters."); return 0; } + if (!q) + { + raiseScriptError(s, "chr_set_quest called for nonexistent character."); + return 0; + } setQuestVar(q, m, n); return 0; } |