From 864c9d81f9aedb18410e08d259f93636d2648be3 Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Thu, 19 Jan 2006 17:06:18 +0300 Subject: [PATCH] IDEADEV-4148 --- .../com/intellij/debugger/SourcePosition.java | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/debugger/openapi/com/intellij/debugger/SourcePosition.java b/debugger/openapi/com/intellij/debugger/SourcePosition.java index 6f237584d9..870d3bcb9d 100644 --- a/debugger/openapi/com/intellij/debugger/SourcePosition.java +++ b/debugger/openapi/com/intellij/debugger/SourcePosition.java @@ -127,13 +127,15 @@ public abstract class SourcePosition implements Navigatable{ protected int calcOffset() { final Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file); - try { - return document.getLineStartOffset(line); - } - catch (IndexOutOfBoundsException e) { - // may happen if document has been changed since the this SourcePosition was created - return -1; + if (document != null) { + try { + return document.getLineStartOffset(line); + } + catch (IndexOutOfBoundsException e) { + // may happen if document has been changed since the this SourcePosition was created + } } + return -1; } }; } @@ -142,13 +144,15 @@ public abstract class SourcePosition implements Navigatable{ return new SourcePositionCache(file) { protected int calcLine() { final Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file); - try { - return document.getLineNumber(offset); - } - catch (IndexOutOfBoundsException e) { - // may happen if document has been changed since the this SourcePosition was created - return -1; + if (document != null) { + try { + return document.getLineNumber(offset); + } + catch (IndexOutOfBoundsException e) { + // may happen if document has been changed since the this SourcePosition was created + } } + return -1; } protected int calcOffset() { -- 2.11.4.GIT