From f147a4f8370f9e8dee07cd2b6916eb7cb7e69627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Andr=C3=A9s=20Margffoy=20Tuay?= Date: Wed, 14 Jul 2021 17:46:25 -0500 Subject: [PATCH] Prevent hard reference to the editor on the mainwindow --- spyder/app/mainwindow.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spyder/app/mainwindow.py b/spyder/app/mainwindow.py index f430f837939..beddce1eaa2 100644 --- a/spyder/app/mainwindow.py +++ b/spyder/app/mainwindow.py @@ -1474,10 +1474,11 @@ def update_edit_menu(self): # instance console, not_readonly, readwrite_editor = textedit_properties - # Editor has focus and there is no file opened in it - if (not console and not_readonly and self.editor - and not self.editor.is_file_opened()): - return + if hasattr(self, 'editor'): + # Editor has focus and there is no file opened in it + if (not console and not_readonly and self.editor + and not self.editor.is_file_opened()): + return # Disabling all actions to begin with for child in self.edit_menu.actions():