diff --git a/Grbl_Esp32/src/StackTrace/AssertionFailed.cpp b/Grbl_Esp32/src/StackTrace/AssertionFailed.cpp index 94bec352..f1f2c1b3 100644 --- a/Grbl_Esp32/src/StackTrace/AssertionFailed.cpp +++ b/Grbl_Esp32/src/StackTrace/AssertionFailed.cpp @@ -35,16 +35,15 @@ AssertionFailed AssertionFailed::create(const char* condition, const char* msg, va_list arg; va_start(arg, msg); size_t len = vsnprintf(tmp, 255, msg, arg); - tmp[254] = 0; - - msg = tmp; + va_end(arg); + tmp[254] = 0; st += tmp; st += " at: "; st += esp_backtrace_print(10); - return AssertionFailed(st); + return AssertionFailed(st, tmp); } #else diff --git a/Grbl_Esp32/src/StackTrace/AssertionFailed.h b/Grbl_Esp32/src/StackTrace/AssertionFailed.h index 1a447188..7bc660e9 100644 --- a/Grbl_Esp32/src/StackTrace/AssertionFailed.h +++ b/Grbl_Esp32/src/StackTrace/AssertionFailed.h @@ -26,7 +26,7 @@ public: String stackTrace; String msg; - AssertionFailed(String st) : stackTrace(st) {} + AssertionFailed(String st, String message) : stackTrace(st), msg(message) {} static AssertionFailed create(const char* condition) { return create(condition, "Assertion failed"); } static AssertionFailed create(const char* condition, const char* msg, ...);