diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-12-07 15:43:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-07 15:43:47 +0100 |
commit | 19f2a188bb305c4a446f63a0b5417086b7261514 (patch) | |
tree | c62925013f9bdfd93be29a3c83b509a2ccbccbe6 | |
parent | c2e96c65b375def81fc13e737d1be02093951c44 (diff) | |
parent | 78c9677816ee819a1be1059ba1a4947168115410 (diff) |
Merge pull request #22934 from SeleckyErik/issue-11457
GDscript function str2var now returns null on invalid input
-rw-r--r-- | modules/gdscript/gdscript_functions.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp index 2f31d59c46..9ff33594ce 100644 --- a/modules/gdscript/gdscript_functions.cpp +++ b/modules/gdscript/gdscript_functions.cpp @@ -758,22 +758,14 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ r_ret = Variant(); return; } + r_ret = *p_args[0]; VariantParser::StreamString ss; ss.s = *p_args[0]; String errs; int line; - Error err = VariantParser::parse(&ss, r_ret, errs, line); - - if (err != OK) { - r_error.error = Variant::CallError::CALL_ERROR_INVALID_ARGUMENT; - r_error.argument = 0; - r_error.expected = Variant::STRING; - r_ret = "Parse error at line " + itos(line) + ": " + errs; - return; - } - + (void)VariantParser::parse(&ss, r_ret, errs, line); } break; case VAR_TO_BYTES: { VALIDATE_ARG_COUNT(1); |