From: Hannu Niemistö Date: Tue, 6 Jun 2017 21:08:03 +0000 (+0300) Subject: (refs #7284) Fixed SCLAnnotationModel to cope invalid error ranges X-Git-Tag: v1.31.0~328^2 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F10%2F610%2F1;p=simantics%2Fplatform.git (refs #7284) Fixed SCLAnnotationModel to cope invalid error ranges Change-Id: I346088d720595a213445c8cb988de442cfb90863 --- 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); }