diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index aa4bd0fee43921a0e4adea7470579b6c4b684a58..e5c3202d853796397287c4d7df1e170e954ea64c 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -882,6 +882,7 @@ DiffEditor::DiffEditor *GitClient::findExistingOrOpenNewDiffEditor(const char *r
         QString title = titlePattern;
         editor = qobject_cast<DiffEditor::DiffEditor *>(
                     Core::EditorManager::openEditorWithContents(editorId, &title, m_msgWait.toUtf8()));
+        QTC_ASSERT(editor, return 0);
         editor->document()->setProperty(registerDynamicProperty, dynamicPropertyValue);
         Core::EditorManager::activateEditor(editor);
     }