From 6e4b5bd0cae051ce1fd1f954aee4e96a5c806c61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Brammer?= Date: Sun, 30 Dec 2012 00:59:50 +0100 Subject: [PATCH] Don't crash on Call() --- src/script/C4Script.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/script/C4Script.cpp b/src/script/C4Script.cpp index 1212cfd7b..3d35ed43d 100644 --- a/src/script/C4Script.cpp +++ b/src/script/C4Script.cpp @@ -220,11 +220,16 @@ static C4Value FnCall(C4PropList * _this, C4Value * Pars) if (!_this) return C4Value(); C4AulParSet ParSet(&Pars[1], 9); C4AulFunc * fn = Pars[0].getFunction(); - if (!fn) - fn = _this->GetFunc(Pars[0].getStr()); + C4String * name; if (!fn) { - const char * s = FnStringPar(Pars[0].getStr()); + name = Pars[0].getStr(); + if (name) + fn = _this->GetFunc(name); + } + if (!fn) + { + const char * s = FnStringPar(name); if (s[0] == '~') { fn = _this->GetFunc(&s[1]);