diff options
author | Mickael Istria | 2019-07-29 12:21:39 +0000 |
---|---|---|
committer | Mickael Istria | 2019-07-29 12:22:03 +0000 |
commit | b98b09af8641e5048608225020caf0f7ce153e8e (patch) | |
tree | 89394c87fdb6f0a226db5bcd6118b62babf3d586 | |
parent | e8b733007b85e76ddab4836dad7175c5012cc000 (diff) | |
download | eclipse.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>
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 28e80553d42..5fd7a0c9ab6 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 699a92d8545..0e5df9419c6 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; |