fix segmentation fault on clicking red point in compilation console if that compilation error coverts several units in plcopen file
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Mon, 28 Nov 2016 16:12:27 +0300
changeset 1579 418e6bac22e8
parent 1578 f8e2a04c4445
child 1580 f37b88d3edc6
fix segmentation fault on clicking red point in compilation console if that compilation error coverts several units in plcopen file

closes #11
ProjectController.py
--- a/ProjectController.py	Thu Nov 24 18:33:56 2016 +0300
+++ b/ProjectController.py	Mon Nov 28 16:12:27 2016 +0300
@@ -1080,8 +1080,14 @@
     def ShowError(self, logger, from_location, to_location):
         chunk_infos = self.GetChunkInfos(from_location, to_location)
         for infos, (start_row, start_col) in chunk_infos:
-            start = (from_location[0] - start_row, from_location[1] - start_col)
-            end = (to_location[0] - start_row, to_location[1] - start_col)
+            row = 1 if from_location[0] < start_row else (from_location[0] - start_row)            
+            col = 1 if (start_row != from_location[0]) else (from_location[1] - start_col)
+            start = (row, col)
+
+            row = 1 if to_location[0] < start_row else (to_location[0] - start_row)            
+            col = 1 if (start_row != to_location[0]) else (to_location[1] - start_col)
+            end = (row, col)
+            
             if self.AppFrame is not None:
                 self.AppFrame.ShowError(infos, start, end)