From a6956ccac707e3c4110ad2133bdf970212d230f8 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Thu, 15 May 2025 22:08:17 +0200 Subject: [PATCH] more elegant solution: append note to error message --- src/i_system.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/i_system.c b/src/i_system.c index 6fa1aeea..d313400d 100644 --- a/src/i_system.c +++ b/src/i_system.c @@ -76,6 +76,13 @@ void I_ErrorOrSuccess(int err_code, const char *prefix, const char *error, ...) void I_ErrorMsg() { + const char note[] = "\nNote: This is an error message and not a \"crash\"!"; + + if (exit_code != 0 && sizeof(errmsg) - strlen(errmsg) > strlen(note)) + { + strcat(errmsg, note); + } + //! // @category obscure // @@ -87,9 +94,7 @@ void I_ErrorMsg() SDL_ShowSimpleMessageBox(exit_code == 0 ? SDL_MESSAGEBOX_INFORMATION : SDL_MESSAGEBOX_ERROR, - exit_code == 0 ? - PROJECT_STRING : - PROJECT_STRING ": Error message (this is not a \"crash\"!)", errmsg, NULL); + PROJECT_STRING, errmsg, NULL); } }