Git: Fix crash when opening git grep search result with tree

... if the contents is unchanged.

Amends commit eb6a2f2b89.

Change-Id: Ief59a2ea2feeafa5834035402d461faf3c3c0e9e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Orgad Shaneh
2021-04-28 07:48:19 +03:00
committed by Eike Ziller
parent b3bd8b81c4
commit f0bdead363

View File

@@ -318,7 +318,8 @@ IEditor *GitGrep::openEditor(const SearchResultItem &item,
const QString topLevel = parameters.additionalParameters.toString();
IEditor *editor = m_client->openShowEditor(
topLevel, params.ref, path, GitClient::ShowEditor::OnlyIfDifferent);
editor->gotoLine(item.mainRange().begin.line, item.mainRange().begin.column);
if (editor)
editor->gotoLine(item.mainRange().begin.line, item.mainRange().begin.column);
return editor;
}