COpenDoc *pOpenDoc = static_cast<COpenDoc *>(theApp.m_pOpenTemplate->CreateNewDocument());
CFrameWnd * pFrame = GetActiveFrame();
- FRAMETYPE frame = GetFrameType(pFrame);
+ FRAMETYPE frame = pFrame ? GetFrameType(pFrame) : FRAME_OTHER;
if (frame == FRAME_FILE || frame == FRAME_HEXFILE || frame == FRAME_IMGFILE)
{
else if (frame == FRAME_FOLDER)
{
// Get paths currently in compare
- const CDirDoc * pDoc = static_cast<const CDirDoc*>(pFrame->GetActiveDocument());
- const CDiffContext& ctxt = pDoc->GetDiffContext();
-
- // Set-up the dialog
- for (int pane = 0; pane < ctxt.GetCompareDirs(); ++pane)
+ if (const CDirDoc* pDoc = static_cast<const CDirDoc*>(pFrame->GetActiveDocument()))
{
- pOpenDoc->m_dwFlags[pane] = FFILEOPEN_PROJECT | (pDoc->GetReadOnly(pane) ? FFILEOPEN_READONLY : 0);
- pOpenDoc->m_files.SetPath(pane, paths::AddTrailingSlash(ctxt.GetNormalizedPath(pane)));
+ const CDiffContext& ctxt = pDoc->GetDiffContext();
+
+ // Set-up the dialog
+ for (int pane = 0; pane < ctxt.GetCompareDirs(); ++pane)
+ {
+ pOpenDoc->m_dwFlags[pane] = FFILEOPEN_PROJECT | (pDoc->GetReadOnly(pane) ? FFILEOPEN_READONLY : 0);
+ pOpenDoc->m_files.SetPath(pane, paths::AddTrailingSlash(ctxt.GetNormalizedPath(pane)));
+ }
+ pOpenDoc->m_bRecurse = ctxt.m_bRecursive;
+ pOpenDoc->m_strExt = static_cast<FileFilterHelper*>(ctxt.m_piFilterGlobal)->GetFilterNameOrMask();
}
- pOpenDoc->m_bRecurse = ctxt.m_bRecursive;
- pOpenDoc->m_strExt = static_cast<FileFilterHelper *>(ctxt.m_piFilterGlobal)->GetFilterNameOrMask();
}
CFrameWnd *pOpenFrame = theApp.m_pOpenTemplate->CreateNewFrame(pOpenDoc, nullptr);
if (dlg.DoModal() == IDOK)
{
CMergeDoc * pDoc1 = GetDocument();
- CMergeEditView * pCurrentView = nullptr;
// Get views
- pCurrentView = GetGroupView(m_nThisPane);
+ CMergeEditView * pCurrentView = GetGroupView(m_nThisPane);
int num = 0;
try { num = std::stoi(dlg.m_strParam) - 1; } catch(...) {}
if (diff >= pDoc1->m_diffList.GetSize())
diff = pDoc1->m_diffList.GetSize();
- pCurrentView->SelectDiff(diff, true, false);
+ if (pCurrentView)
+ pCurrentView->SelectDiff(diff, true, false);
}
}
}
for (int i = 0; i < m_list.GetItemCount(); ++i)
{
PluginInfo * plugin = CAllThreadsScripts::GetActiveSet()->GetPluginByName(nullptr, String(m_list.GetItemText(i, 0)));
- plugin->m_disabled = !m_list.GetCheck(i);
+ if (plugin)
+ plugin->m_disabled = !m_list.GetCheck(i);
}
CAllThreadsScripts::GetActiveSet()->SaveSettings();