Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2013-10-31 07:04:21 -0400
committerAnton Leherbauer2013-10-31 07:04:21 -0400
commitf70547c526a18715c71ad26349b38342fd816aa1 (patch)
treec864faa38d58146c3ce608fb88661b20e5cc11a3
parentf46724244cd1d6eb5dee2709e633d8011ec2dd71 (diff)
downloadorg.eclipse.cdt-f70547c526a18715c71ad26349b38342fd816aa1.tar.gz
org.eclipse.cdt-f70547c526a18715c71ad26349b38342fd816aa1.tar.xz
org.eclipse.cdt-f70547c526a18715c71ad26349b38342fd816aa1.zip
Fix NPE in CDebugUIUtils.getEditorFilePath() if file does not exist
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java
index 58f0ce164f..a7b561ee4f 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugUIUtils.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 QNX Software Systems and others.
+ * Copyright (c) 2000, 2013 QNX Software Systems 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
@@ -11,6 +11,7 @@
*******************************************************************************/
package org.eclipse.cdt.debug.internal.ui;
+import java.net.URI;
import java.util.Iterator;
import org.eclipse.cdt.debug.core.CDebugUtils;
@@ -127,7 +128,7 @@ public class CDebugUIUtils {
static public String getValueText( IValue value ) {
StringBuffer label = new StringBuffer();
if ( value instanceof ICDebugElementStatus && !((ICDebugElementStatus)value).isOK() ) {
- label.append( MessageFormat.format( CDebugUIMessages.getString( "CDTDebugModelPresentation.4" ), new String[] { ((ICDebugElementStatus)value).getMessage() } ) ); //$NON-NLS-1$
+ label.append( MessageFormat.format( CDebugUIMessages.getString( "CDTDebugModelPresentation.4" ), (Object[]) new String[] { ((ICDebugElementStatus)value).getMessage() } ) ); //$NON-NLS-1$
}
else if ( value instanceof ICValue ) {
ICType type = null;
@@ -201,7 +202,18 @@ public class CDebugUIUtils {
public static String getEditorFilePath( IEditorInput input ) throws CoreException {
if ( input instanceof IFileEditorInput ) {
- return ((IFileEditorInput)input).getFile().getLocation().toOSString();
+ IPath location = ((IFileEditorInput)input).getFile().getLocation();
+ if (location != null) {
+ return location.toOSString();
+ }
+ URI locationURI = ((IFileEditorInput)input).getFile().getLocationURI();
+ if (locationURI != null) {
+ IPath uriPath = URIUtil.toPath(locationURI);
+ if (uriPath != null) {
+ return uriPath.toOSString();
+ }
+ }
+ return ""; //$NON-NLS-1$
}
if ( input instanceof IStorageEditorInput ) {
return ((IStorageEditorInput)input).getStorage().getFullPath().toOSString();

Back to the top