diff --git a/src/os/windows/crashlog_win.cpp b/src/os/windows/crashlog_win.cpp index 802802839d..c23bb4150a 100644 --- a/src/os/windows/crashlog_win.cpp +++ b/src/os/windows/crashlog_win.cpp @@ -494,14 +494,14 @@ static INT_PTR CALLBACK CrashDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARA char *crashlog_dos_nl = reinterpret_cast(filename_buf + filename_buf_length * filename_count); /* Convert unix -> dos newlines because the edit box only supports that properly. */ - const char *crashlog_unix_nl = crashlog.c_str(); - char *p = crashlog_dos_nl; - char32_t c; - while ((c = Utf8Consume(&crashlog_unix_nl))) { - if (c == '\n') p += Utf8Encode(p, '\r'); - p += Utf8Encode(p, c); + { + char *p = crashlog_dos_nl; + for (char c : crashlog) { + if (c == '\n') *(p++) = '\r'; + *(p++) = c; + } + *p = '\0'; } - *p = '\0'; _snwprintf( crash_desc_buf,