# HG changeset patch
# User Andrey Skvortsov <andrej.skvortzov@gmail.com>
# Date 1480338747 -10800
# Node ID 418e6bac22e86747c22b774092c568484381a315
# Parent  f8e2a04c44459d279dbe676cf0070c937e7c2c9f
fix segmentation fault on clicking red point in compilation console if that compilation error coverts several units in plcopen file

closes #11

diff -r f8e2a04c4445 -r 418e6bac22e8 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)