From 736bfe29ff25926b86d1d902a249dc9f44c9d83b Mon Sep 17 00:00:00 2001 From: lx-s Date: Wed, 8 Jul 2026 10:40:10 +0200 Subject: [PATCH] Fixed possible crash in LogDialog (if WM_SIZE happens before init) --- WinMute/LogDialog.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/WinMute/LogDialog.cpp b/WinMute/LogDialog.cpp index da3f030..251182d 100644 --- a/WinMute/LogDialog.cpp +++ b/WinMute/LogDialog.cpp @@ -87,6 +87,10 @@ INT_PTR CALLBACK LogDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) return 0; case WM_SIZE: { + // WM_SIZE arrives before WM_INITDIALOG, when dlgData is not set yet + if (dlgData == nullptr) { + return 0; + } RECT rcClient; GetClientRect(hDlg, &rcClient); SetWindowPos( @@ -102,7 +106,7 @@ INT_PTR CALLBACK LogDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) case WM_LOG_UPDATED: { const WMLog &wmLog = WMLog::GetInstance(); auto logMsg = reinterpret_cast(lParam); - if (logMsg == nullptr) { + if (dlgData == nullptr || logMsg == nullptr) { return FALSE; } const auto formattedMsg = wmLog.FormatLogMessage(*logMsg, true); -- 2.43.0