diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2018-12-14 17:13:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-14 17:13:16 +0100 |
commit | f11047aa81563343eb8b3d8d989af393fd2639b6 (patch) | |
tree | 4713cc1f401ac034276a18ada4658123b0cbcc80 | |
parent | 1fb47046bb2e2aa3ddb7f7a5a48d012984562eb7 (diff) | |
parent | f5a8637e7aa6561db811548b419839b5bfa32fd4 (diff) |
Merge pull request #21856 from AlexHolly/fix-undo-not-showing-error
Fix undo redo not showing errors
-rw-r--r-- | core/undo_redo.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp index 3d41c374ea..f2f521c196 100644 --- a/core/undo_redo.cpp +++ b/core/undo_redo.cpp @@ -268,7 +268,24 @@ void UndoRedo::_process_operation_list(List<Operation>::Element *E) { case Operation::TYPE_METHOD: { - obj->call(op.name, VARIANT_ARGS_FROM_ARRAY(op.args)); + Vector<const Variant *> argptrs; + argptrs.resize(VARIANT_ARG_MAX); + int argc = 0; + + for (int i = 0; i < VARIANT_ARG_MAX; i++) { + if (op.args[i].get_type() == Variant::NIL) { + break; + } + argptrs.write[i] = &op.args[i]; + argc++; + } + argptrs.resize(argc); + + Variant::CallError ce; + obj->call(op.name, (const Variant **)argptrs.ptr(), argc, ce); + if (ce.error != Variant::CallError::CALL_OK) { + ERR_PRINTS("Error calling method from signal '" + String(op.name) + "': " + Variant::get_call_error_text(obj, op.name, (const Variant **)argptrs.ptr(), argc, ce)); + } #ifdef TOOLS_ENABLED Resource *res = Object::cast_to<Resource>(obj); if (res) |