IDE: Log: Prevent crash when display progress on empty log.
authorEdouard Tisserant
Fri, 11 Jun 2021 11:56:07 +0200
changeset 2740 610801fe1b88
parent 2739 7278186a2083
child 2741 3cc5663af196
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,