From b0fe8a028707326196e54e112981b10a08848dc1 Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Wed, 19 Jan 2005 00:12:14 +0000 Subject: [PATCH] Fix for bug 82858: NPE when adding global variable to variable view. --- debug/org.eclipse.cdt.debug.core/ChangeLog | 5 +++++ .../eclipse/cdt/debug/internal/core/model/CDebugTarget.java | 2 +- .../cdt/debug/internal/core/model/CVariableFactory.java | 6 +++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index d424b10a5e8..7f794aebe55 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,8 @@ +2005-01-18 Mikhail Khodjaiants + Fix for bug 82858: NPE when adding global variable to variable view. + * CDebugTarget.java + * CVariableFactory.java + 2005-01-18 Mikhail Khodjaiants Fix for bug 82800: Make "Resume At Line" action retargettable. CDebugElement should provide an adapter to ICDebugTarget. diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java index f0a145412af..68434053aea 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java @@ -1786,7 +1786,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv public ICGlobalVariable createGlobalVariable( IGlobalVariableDescriptor info ) throws DebugException { ICDIVariableDescriptor vo = null; try { - vo = getCDITarget().getGlobalVariableDescriptors(info.getPath().lastSegment(), null, info.getName()); + vo = getCDITarget().getGlobalVariableDescriptors( info.getPath().lastSegment(), null, info.getName() ); } catch( CDIException e ) { throw new DebugException( new Status( IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED, (vo != null) ? vo.getName() + ": " + e.getMessage() : e.getMessage(), null ) ); //$NON-NLS-1$ diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariableFactory.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariableFactory.java index c7d1d15313c..ddd22121ee1 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariableFactory.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariableFactory.java @@ -34,7 +34,7 @@ public class CVariableFactory { } public static IGlobalVariableDescriptor createGlobalVariableDescriptor( final String name, final IPath path ) { - + return new IGlobalVariableDescriptor() { public String getName() { @@ -42,7 +42,7 @@ public class CVariableFactory { } public IPath getPath() { - return path; + return ( path != null ) ? path : new Path( "" ); //$NON-NLS-1$ } public String toString() { @@ -60,7 +60,7 @@ public class CVariableFactory { return createGlobalVariableDescriptor( var.getElementName(), path ); } - public static IGlobalVariableDescriptor createGlobalVariableDescriptor(ISymbol symbol) { + public static IGlobalVariableDescriptor createGlobalVariableDescriptor( ISymbol symbol ) { return createGlobalVariableDescriptor( symbol.getName(), symbol.getFilename() ); }