diff --git a/src/libneochat/chatdocumenthandler.cpp b/src/libneochat/chatdocumenthandler.cpp index ff0946d07..4cd354f11 100644 --- a/src/libneochat/chatdocumenthandler.cpp +++ b/src/libneochat/chatdocumenthandler.cpp @@ -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]() {