diff --git a/src/chatdocumenthandler.cpp b/src/chatdocumenthandler.cpp index 5ff6ab6bf..f266ab64a 100644 --- a/src/chatdocumenthandler.cpp +++ b/src/chatdocumenthandler.cpp @@ -117,6 +117,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]() {