https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8ba330ead276cd1c1bdb8dd728e109db557b9a49

commit 8ba330ead276cd1c1bdb8dd728e109db557b9a49
Author:     Katayama Hirofumi MZ <[email protected]>
AuthorDate: Sun Jun 18 20:34:49 2023 +0900
Commit:     Katayama Hirofumi MZ <[email protected]>
CommitDate: Sun Jun 18 20:34:49 2023 +0900

    [MSPAINT] Follow-up of #5349 (9f56e67); Avoid assertion failure
    
    CORE-18867
---
 base/applications/mspaint/winproc.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/base/applications/mspaint/winproc.cpp 
b/base/applications/mspaint/winproc.cpp
index ec714193b7c..c3fa27d6445 100644
--- a/base/applications/mspaint/winproc.cpp
+++ b/base/applications/mspaint/winproc.cpp
@@ -423,8 +423,9 @@ LRESULT CMainWindow::OnInitMenuPopup(UINT nMsg, WPARAM 
wParam, LPARAM lParam, BO
         (selectionModel.m_bShow &&
          ((toolsModel.GetActiveTool() == TOOL_FREESEL) || 
(toolsModel.GetActiveTool() == TOOL_RECTSEL)));
     BOOL textShown = (toolsModel.GetActiveTool() == TOOL_TEXT && 
::IsWindowVisible(textEditWindow));
-    DWORD dwStart, dwEnd;
-    textEditWindow.SendMessage(EM_GETSEL, (WPARAM)&dwStart, (LPARAM)&dwEnd);
+    DWORD dwStart = 0, dwEnd = 0;
+    if (::IsWindowVisible(textEditWindow))
+        textEditWindow.SendMessage(EM_GETSEL, (WPARAM)&dwStart, 
(LPARAM)&dwEnd);
     BOOL hasTextSel = (dwStart < dwEnd);
 
     switch (lParam)

Reply via email to