From a8332e30f0ee82712d303f29e96fbc9e0c0aae49 Mon Sep 17 00:00:00 2001 From: George Marques Date: Tue, 26 May 2020 20:38:44 -0300 Subject: [PATCH] GDScript: Fix assert message when no custom message is set (cherry picked from commit f29a2e2606317e0964ffed287187afe6bf115626) --- modules/gdscript/gdscript_function.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index 027350a665d..82829856dfa 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -1501,11 +1501,14 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a #ifdef DEBUG_ENABLED GET_VARIANT_PTR(test, 1); - GET_VARIANT_PTR(message, 2); bool result = test->booleanize(); if (!result) { - const String &message_str = *message; + String message_str; + if (_code_ptr[ip + 2] != 0) { + GET_VARIANT_PTR(message, 2); + message_str = *message; + } if (message_str.empty()) { err_text = "Assertion failed."; } else {