Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2019-07-29 08:21:39 -0400
committerMickael Istria2019-07-29 08:22:03 -0400
commitb98b09af8641e5048608225020caf0f7ce153e8e (patch)
tree89394c87fdb6f0a226db5bcd6118b62babf3d586
parente8b733007b85e76ddab4836dad7175c5012cc000 (diff)
downloadeclipse.platform.text-b98b09af8641e5048608225020caf0f7ce153e8e.tar.gz
eclipse.platform.text-b98b09af8641e5048608225020caf0f7ce153e8e.tar.xz
eclipse.platform.text-b98b09af8641e5048608225020caf0f7ce153e8e.zip
Bug 548446 - inline annotations + "Folding>Collapse All" can cause NPEY20190730-0135Y20190730-0055I20190729-1800
Change-Id: If94b0e49bfeb53fc38644e8950df4e7d141c1d16 Signed-off-by: Mickael Istria <mistria@redhat.com>
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/AbstractInlinedAnnotation.java6
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/LineContentAnnotation.java3
2 files changed, 8 insertions, 1 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/AbstractInlinedAnnotation.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/AbstractInlinedAnnotation.java
index 28e80553d..5fd7a0c9a 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/AbstractInlinedAnnotation.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/AbstractInlinedAnnotation.java
@@ -88,7 +88,11 @@ public abstract class AbstractInlinedAnnotation extends Annotation {
final Position computeWidgetPosition() {
if (fViewer instanceof ITextViewerExtension5) {
IRegion region= ((ITextViewerExtension5) fViewer).modelRange2WidgetRange(new Region(position.getOffset(), position.getLength()));
- return new Position(region.getOffset(), region.getLength());
+ if (region != null) {
+ return new Position(region.getOffset(), region.getLength());
+ } else {
+ return null;
+ }
}
return position;
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/LineContentAnnotation.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/LineContentAnnotation.java
index 699a92d85..0e5df9419 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/LineContentAnnotation.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/inlined/LineContentAnnotation.java
@@ -115,6 +115,9 @@ public class LineContentAnnotation extends AbstractInlinedAnnotation {
*/
StyleRange updateStyle(StyleRange style) {
Position widgetPosition= computeWidgetPosition();
+ if (widgetPosition == null) {
+ return null;
+ }
boolean usePreviousChar= drawRightToPreviousChar(widgetPosition.getOffset());
if (width == 0 || getRedrawnCharacterWidth() == 0) {
return null;

Back to the top