From f35b1c0ad6c184ab3bdd422366260c197b8e2504 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 1 Nov 2020 18:14:43 +0100 Subject: [PATCH] Don't allow inserts when no document is open --- nw/gui/doceditor.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index 85a3f75d..005c6ffa 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -705,6 +705,10 @@ class GuiDocEditor(QTextEdit): def insertText(self, theInsert): """Insert a specific type of text at the cursor position. """ + if self.theHandle is None: + logger.error("No document open") + return False + if isinstance(theInsert, str): theText = theInsert elif isinstance(theInsert, nwDocInsert):