]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
(refs #7284) Fixed SCLAnnotationModel to cope invalid error ranges 10/610/1
authorHannu Niemistö <hannu.niemisto@semantum.fi>
Tue, 6 Jun 2017 21:08:03 +0000 (00:08 +0300)
committerHannu Niemistö <hannu.niemisto@semantum.fi>
Tue, 6 Jun 2017 21:08:03 +0000 (00:08 +0300)
Change-Id: I346088d720595a213445c8cb988de442cfb90863

bundles/org.simantics.scl.ui/src/org/simantics/scl/ui/editor2/SCLAnnotationModel.java

index b8010ef828a23868ba0b24b7820c53be38ef2dfa..2a04c41cf1f1169721208c0eabce52ce58c31de2 100644 (file)
@@ -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);
             }