IDE: Log: Prevent crash when display progress on empty log. svghmi
authorEdouard Tisserant
Fri, 11 Jun 2021 11:56:07 +0200
branchsvghmi
changeset 3256 8d1cc99a8f54
parent 3254 b1bc6099d4e5
child 3257 095c73591b7e
IDE: Log: Prevent crash when display progress on empty log.
BeremizIDE.py
--- a/BeremizIDE.py	Thu Jun 10 09:40:05 2021 +0200
+++ b/BeremizIDE.py	Fri Jun 11 11:56:07 2021 +0200
@@ -223,7 +223,7 @@
         return False
 
     def progress(self, text):
-        l = self.output.GetLineCount()-2
+        l = max(self.output.GetLineCount()-2, 0)
         self.output.AnnotationSetText(l, text)
         self.output.AnnotationSetVisible(wx.stc.STC_ANNOTATION_BOXED)
         self.output.AnnotationSetStyle(l, self.black_white)
@@ -496,6 +496,7 @@
             self.local_runtime_tmpdir = tempfile.mkdtemp()
             # choose an arbitrary random port for runtime
             self.runtime_port = int(random.random() * 1000) + 61131
+            self.Log.write(_("Starting local runtime...\n"))
             # launch local runtime
             self.local_runtime = ProcessLogger(
                 self.Log,