Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorNathan Ridge2015-07-18 06:24:04 +0000
committerGerrit Code Review @ Eclipse.org2015-07-25 17:07:32 +0000
commit95aa27858c89c7a0e0332296c736c4757d46f7a3 (patch)
tree7bfc6a12a5d9c91a3c8024044deb6c160b9c40b3 /core
parent8af3f1df866e526686a60889226d405257b55f24 (diff)
downloadorg.eclipse.cdt-95aa27858c89c7a0e0332296c736c4757d46f7a3.tar.gz
org.eclipse.cdt-95aa27858c89c7a0e0332296c736c4757d46f7a3.tar.xz
org.eclipse.cdt-95aa27858c89c7a0e0332296c736c4757d46f7a3.zip
Bug 389191 - NPE in CDocHover.getHoverInfo()
Change-Id: Ied3f42206a5af49577bc487b3c40a1b87a02cd02 Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CDocHover.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CDocHover.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CDocHover.java
index 2361fb9ea2..6ba993ce57 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CDocHover.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/CDocHover.java
@@ -12,6 +12,7 @@
package org.eclipse.cdt.internal.ui.text.c.hover;
import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.Region;
@@ -46,7 +47,11 @@ public class CDocHover extends AbstractCEditorTextHover {
if (getEditor() == null)
return null;
try {
- expression = viewer.getDocument().get(region.getOffset(), region.getLength());
+ IDocument document = viewer.getDocument();
+ if (document == null) {
+ return null;
+ }
+ expression = document.get(region.getOffset(), region.getLength());
expression = expression.trim();
if (expression.isEmpty())
return null;

Back to the top