Make sure that ChatDocumentHandler can handle the document being changed to a nullptr

Make sure that ChatDocumentHandler can handle the document being changed to a nullptr.

BUG: 501950
This commit is contained in:
James Graham
2025-05-05 15:45:50 +01:00
parent 6913a4b447
commit 97d5be9d81

View File

@@ -118,6 +118,10 @@ ChatDocumentHandler::ChatDocumentHandler(QObject *parent)
});
});
connect(this, &ChatDocumentHandler::documentChanged, this, [this]() {
if (!m_document) {
m_highlighter->setDocument(nullptr);
return;
}
m_highlighter->setDocument(m_document->textDocument());
});
connect(this, &ChatDocumentHandler::cursorPositionChanged, this, [this]() {