Commit 6b13434a authored by hjk's avatar hjk
Browse files

debugger: don't crash in gotoLocation() if no editor can be created

parent 6ddee480
......@@ -536,12 +536,18 @@ void DebuggerEngine::gotoLocation(const Location &loc)
const int line = loc.lineNumber();
EditorManager *editorManager = EditorManager::instance();
QList<IEditor *> editors = editorManager->editorsForFileName(file);
IEditor *editor = 0;
if (editors.isEmpty()) {
editors.append(editorManager->openEditor(file, QString(),
EditorManager::IgnoreNavigationHistory));
editors.back()->setProperty(Constants::OPENED_BY_DEBUGGER, true);
editor = editorManager->openEditor(file, QString(),
EditorManager::IgnoreNavigationHistory);
if (editor) {
editors.append(editor);
editor->setProperty(Constants::OPENED_BY_DEBUGGER, true);
}
} else {
editor = editors.back();
}
ITextEditor *texteditor = qobject_cast<ITextEditor *>(editors.back());
ITextEditor *texteditor = qobject_cast<ITextEditor *>(editor);
if (texteditor)
texteditor->gotoLine(line, 0);
......@@ -550,7 +556,7 @@ void DebuggerEngine::gotoLocation(const Location &loc)
// FIXME: Breaks with split views.
if (!d->m_memoryAgent.hasVisibleEditor() || loc.needsRaise())
editorManager->activateEditor(editors.back());
editorManager->activateEditor(editor);
//qDebug() << "MEMORY: " << d->m_memoryAgent.hasVisibleEditor();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment