Skip to content

Commit 56c4a75

Browse files
committed
qtvcp -qcode editor: fix error with reloading with no program loaded
It's not really an error!
1 parent f70196f commit 56c4a75

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lib/python/qtvcp/widgets/gcode_editor.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ def new_text(self):
326326

327327
def load_text(self, filepath):
328328
self.filepath = filepath
329+
if filepath is None:
330+
return
329331
try:
330332
fp = os.path.expanduser(filepath)
331333
with open(fp) as f:
@@ -334,6 +336,10 @@ def load_text(self, filepath):
334336
LOG.error("load_text(): {}".format(e))
335337
self.setText('')
336338
return
339+
except Exception as e:
340+
LOG.error("load_text(): {}".format(e))
341+
self.setText('')
342+
return
337343
self.ensureCursorVisible()
338344
self.SendScintilla(QsciScintilla.SCI_VERTICALCENTRECARET)
339345
self.setModified(False)

0 commit comments

Comments
 (0)