From 3906e743a8c4717ffae6add4715cade396c6196c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hannu=20Niemist=C3=B6?= Date: Wed, 7 Jun 2017 00:08:03 +0300 Subject: [PATCH] (refs #7284) Fixed SCLAnnotationModel to cope invalid error ranges Change-Id: I346088d720595a213445c8cb988de442cfb90863 --- .../src/org/simantics/scl/ui/editor2/SCLAnnotationModel.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLAnnotationModel.java b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLAnnotationModel.java index b8010ef82..2a04c41cf 100644 --- a/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLAnnotationModel.java +++ b/bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLAnnotationModel.java @@ -14,7 +14,6 @@ import org.simantics.scl.compiler.errors.ErrorSeverity; import org.simantics.scl.compiler.errors.Failable; import org.simantics.scl.compiler.errors.Failure; import org.simantics.scl.compiler.errors.Locations; -import org.simantics.scl.compiler.errors.Success; import org.simantics.scl.compiler.module.Module; import org.simantics.scl.compiler.module.repository.ModuleRepository; import org.simantics.scl.compiler.module.repository.UpdateListener; @@ -61,6 +60,10 @@ public class SCLAnnotationModel extends AnnotationModel { true, error.description); int begin = Locations.beginOf(error.location); int end = Locations.endOf(error.location); + if(begin < 0 || end < begin) { + begin = 0; + end = 1; + } Position position = new Position(begin, end - begin); addAnnotation(annotation, position); } -- 2.47.1