Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2013-12-10 13:48:34 +0000
committerDani Megert2013-12-10 13:48:34 +0000
commit1a2317d2545e5024d72d695f27df5b5c3f067734 (patch)
treeb17e5a53ccf6137e510e59f635ee1921acf25905
parentf26750afeabe1a818ce6887ed205a433cf6fcd25 (diff)
downloadeclipse.platform.text-1a2317d2545e5024d72d695f27df5b5c3f067734.tar.gz
eclipse.platform.text-1a2317d2545e5024d72d695f27df5b5c3f067734.tar.xz
eclipse.platform.text-1a2317d2545e5024d72d695f27df5b5c3f067734.zip
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java
index df8d0f9d0..4736386ab 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/JFaceTextUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
+ * Copyright (c) 2006, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -199,6 +199,8 @@ public final class JFaceTextUtil {
try {
IRegion r= viewer.getVisibleRegion();
IDocument d= viewer.getDocument();
+ if (d == null)
+ return -1;
modelLine= widgetLine + d.getLineOfOffset(r.getOffset());
} catch (BadLocationException x) {
modelLine= widgetLine;
@@ -225,6 +227,8 @@ public final class JFaceTextUtil {
} else {
IRegion region= viewer.getVisibleRegion();
IDocument document= viewer.getDocument();
+ if (document == null)
+ return -1;
try {
int visibleStartLine= document.getLineOfOffset(region.getOffset());
int visibleEndLine= document.getLineOfOffset(region.getOffset() + region.getLength());

Back to the top