Fix segmentation fault when last lines in text POUs should be highlighted
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Mon, 01 Oct 2018 12:04:58 +0300
changeset 2409 00d90ab8a462
parent 2408 23978e5b039a
child 2410 4e7ebd6ec248
Fix segmentation fault when last lines in text POUs should be highlighted
editors/TextViewer.py
--- a/editors/TextViewer.py	Sat Sep 29 19:18:50 2018 +0300
+++ b/editors/TextViewer.py	Mon Oct 01 12:04:58 2018 +0300
@@ -963,4 +963,5 @@
                 self.StartStyling(highlight_start_pos, 0xff)
                 self.SetStyling(highlight_end_pos - highlight_start_pos, highlight_type)
                 self.StartStyling(highlight_start_pos, 0x00)
-                self.SetStyling(len(self.Editor.GetText()) - highlight_end_pos, wx.stc.STC_STYLE_DEFAULT)
+                until_end = max(0, len(self.Editor.GetText()) - highlight_end_pos)
+                self.SetStyling(until_end, wx.stc.STC_STYLE_DEFAULT)