Commit 38527c72 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Fix the check to also handle 0 doc views

BUG: 448847
parent b1802f4a
Pipeline #126423 passed with stage
in 3 minutes and 21 seconds
......@@ -399,15 +399,15 @@ void KateViewSpace::registerDocument(KTextEditor::Document *doc)
void KateViewSpace::closeDocument(KTextEditor::Document *doc)
{
auto it = m_docToView.find(doc);
Q_ASSERT(it != m_docToView.end());
// If this is the only view of the document,
// OR the doc has no views yet
// just close the document and it will take
// care of removing the view + cleaning up the doc
if (doc->views().size() == 1) {
if (doc->views().size() <= 1) {
m_viewManager->slotDocumentClose(doc);
} else {
auto it = m_docToView.find(doc);
Q_ASSERT(it != m_docToView.end());
// We have other views of this doc in other viewspaces
// Just remove the view
m_viewManager->deleteView(it->second);
......
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