From 98e8022fd0cf7d7d7574fb90cbbe4b0fed4e64c7 Mon Sep 17 00:00:00 2001 From: dalthviz Date: Thu, 7 Sep 2017 13:12:49 -0500 Subject: [PATCH] Adds handling for IndexError. --- spyder/widgets/editor.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spyder/widgets/editor.py b/spyder/widgets/editor.py index a6266bc1bf8..8651d06f30d 100644 --- a/spyder/widgets/editor.py +++ b/spyder/widgets/editor.py @@ -1703,8 +1703,13 @@ def current_changed(self, index): self.update_plugin_title.emit() if editor is not None: - self.current_file_changed.emit(self.data[index].filename, + # Needed in order to handle the close of files open in a directory + # that has been renamed. See issue 5157 + try: + self.current_file_changed.emit(self.data[index].filename, editor.get_position('cursor')) + except IndexError: + pass def _get_previous_file_index(self): if len(self.stack_history) > 1: