https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d9afe73de48eba8df3694…
commit d9afe73de48eba8df369418fb1c87b714facb61d
Author: Whindmar Saksit <whindsaks(a)proton.me>
AuthorDate: Sun Sep 8 13:47:32 2024 +0200
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun Sep 8 13:47:32 2024 +0200
[NOTEPAD] Display error code if no error string is available (#7319)
---
base/applications/notepad/dialog.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/base/applications/notepad/dialog.c b/base/applications/notepad/dialog.c
index 6f61df4b899..7185e4a0148 100644
--- a/base/applications/notepad/dialog.c
+++ b/base/applications/notepad/dialog.c
@@ -49,6 +49,7 @@ VOID ShowLastError(VOID)
{
LPTSTR lpMsgBuf = NULL;
TCHAR szTitle[MAX_STRING_LEN];
+ TCHAR szFallback[42], *pszMessage = szFallback;
LoadString(Globals.hInstance, STRING_ERROR, szTitle, _countof(szTitle));
@@ -60,7 +61,12 @@ VOID ShowLastError(VOID)
0,
NULL);
- MessageBox(Globals.hMainWnd, lpMsgBuf, szTitle, MB_OK | MB_ICONERROR);
+ if (lpMsgBuf)
+ pszMessage = lpMsgBuf;
+ else
+ wsprintfW(szFallback, L"%d", error);
+
+ MessageBox(Globals.hMainWnd, pszMessage, szTitle, MB_OK | MB_ICONERROR);
LocalFree(lpMsgBuf);
}
}