summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorErik <35656626+SeleckyErik@users.noreply.github.com>2018-10-11 12:36:38 +0200
committerErik <35656626+SeleckyErik@users.noreply.github.com>2018-11-28 14:47:40 +0100
commit78c9677816ee819a1be1059ba1a4947168115410 (patch)
treeb6877cd77f2c33c26559395c69ce2a360d866a01 /modules
parenteeee47196c19dc271d6fcf8981946a1a29efd16a (diff)
GDscript function str2var now returns input string on invalid input
str2var used to raise a blocking error when invalid input was passed. Now it logs an error message and returns the input string. This solution was proposed in #13021. Closes #11457 and #13021.
Diffstat (limited to 'modules')
-rw-r--r--modules/gdscript/gdscript_functions.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp
index 5af9bbc05f..dcf395fc86 100644
--- a/modules/gdscript/gdscript_functions.cpp
+++ b/modules/gdscript/gdscript_functions.cpp
@@ -729,22 +729,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);