From a6c34bb44d894f39887d47b4d674066f05129d57 Mon Sep 17 00:00:00 2001 From: Roc <1844478+rorlork@users.noreply.github.com> Date: Fri, 13 Mar 2020 00:03:26 +0100 Subject: [PATCH] Fix a crash when trying to show an error with bad separator. For example, a single dot or colon at the end of the error string. --- src/util.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/util.cpp b/src/util.cpp index 6840257f..f2d33c2d 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -138,9 +138,11 @@ static void MessageBox(const char *fmt, va_list va, bool error, } } - std::string::iterator it = description.begin(); - while(isspace(*it)) it++; - description = description.substr(it - description.begin()); + if(description.length() > 0) { + std::string::iterator it = description.begin(); + while(isspace(*it)) it++; + description = description.substr(it - description.begin()); + } Platform::MessageDialogRef dialog = CreateMessageDialog(SS.GW.window); if (!dialog) {