OSDN Git Service

Fix crash when failed to load file
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Wed, 13 Mar 2019 23:52:36 +0000 (08:52 +0900)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Wed, 13 Mar 2019 23:52:36 +0000 (08:52 +0900)
Src/MainFrm.cpp
Src/MergeDoc.cpp

index 2fb8bcb..aaae8bc 100644 (file)
@@ -712,15 +712,16 @@ bool CMainFrame::ShowMergeDoc(CDirDoc * pDirDoc,
 
        // Note that OpenDocs() takes care of closing compare window when needed.
        bool bResult = pMergeDoc->OpenDocs(nFiles, fileloc, GetROFromFlags(nFiles, dwFlags).data(), strDesc);
-
-       if (CChildFrame *pFrame = pMergeDoc->GetParentFrame())
+       if (bResult)
        {
-               if (!pFrame->IsActivated())
-                       pFrame->InitialUpdateFrame(pMergeDoc, true);
+               if (CChildFrame *pFrame = pMergeDoc->GetParentFrame())
+                       if (!pFrame->IsActivated())
+                               pFrame->InitialUpdateFrame(pMergeDoc, true);
        }
-
-       if (!bResult)
+       else
+       {
                return false;
+       }
 
        for (int pane = 0; pane < nFiles; pane++)
        {
index 70ae88c..fd56b93 100644 (file)
@@ -670,7 +670,7 @@ void CMergeDoc::FlagMovedLines(void)
 
 int CMergeDoc::ShowMessageBox(const String& sText, unsigned nType, unsigned nIDHelp)
 {
-       if (!GetParentFrame()->IsActivated())
+       if (m_pView[0][0] && m_pView[0][0]->IsTextBufferInitialized() && !GetParentFrame()->IsActivated())
        {
                GetParentFrame()->InitialUpdateFrame(this, true);
                GetParentFrame()->SendMessageToDescendants(WM_IDLEUPDATECMDUI, static_cast<WPARAM>(true), 0, true, true);