Skip to content

Commit

Permalink
Avoid NPE when annotation.getText() == null
Browse files Browse the repository at this point in the history
  • Loading branch information
mickaelistria committed Mar 29, 2023
1 parent b8b0ff5 commit b9355a2
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,13 @@
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

import org.eclipse.core.resources.IMarker;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;

import org.eclipse.core.resources.IMarker;

import org.eclipse.jface.text.quickassist.IQuickFixableAnnotation;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.IAnnotationAccessExtension;
import org.eclipse.jface.text.source.IAnnotationPresentation;

import org.eclipse.ui.texteditor.MarkerAnnotation;

/**
Expand Down Expand Up @@ -149,7 +146,7 @@ private Stream<Annotation> sort(Locator locator, Stream<Annotation> anns) {
return resultSeverity;
}

return a.getText().compareTo(b.getText());
return a.getText() == null ? (b.getText() == null ? 0 : -1) : (b.getText() == null ? 1 : a.getText().compareTo(a.getText()));
});
}

Expand Down

0 comments on commit b9355a2

Please sign in to comment.