diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index bcede345e50..f5ab083e005 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,8 @@ +2005-02-24 Mikhail Khodjaiants + Applied patch from Tracy Miranda (bug 86540: NPE in CProjectSourceLocation). + Check for the project and synchronization are added to "initializeFolders". + * CProjectSourceLocation.java + 2005-02-22 Mikhail Khodjaiants Bug 84799: Implement Memory View and renderings with new rendering APIs. * CMemoryBlockExtensionRetrieval.java diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java index ecfafbd5fb4..0dba6ca18fa 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java @@ -186,18 +186,21 @@ public class CProjectSourceLocation implements IProjectSourceLocation { if ( list.size() > 0 && !searchForDuplicateFiles() ) break; - IPath path = folders[i].getLocation().append( fileName ); - File file = new File( path.toOSString() ); - if ( file.exists() ) - { - IFile[] wsFiles = CDebugCorePlugin.getWorkspace().getRoot().findFilesForLocation( path ); - for ( int j = 0; j < wsFiles.length; ++j ) - if ( wsFiles[j].exists() ) - { - if ( !searchForDuplicateFiles() ) - return wsFiles[j]; - list.add( wsFiles[j] ); - } + IPath path = folders[i].getLocation(); + if ( path != null ) { + path = path.append( fileName ); + File file = new File( path.toOSString() ); + if ( file.exists() ) + { + IFile[] wsFiles = CDebugCorePlugin.getWorkspace().getRoot().findFilesForLocation( path ); + for ( int j = 0; j < wsFiles.length; ++j ) + if ( wsFiles[j].exists() ) + { + if ( !searchForDuplicateFiles() ) + return wsFiles[j]; + list.add( wsFiles[j] ); + } + } } } return ( list.size() > 0 ) ? ( ( list.size() == 1 ) ? list.getFirst() : list ) : null; @@ -351,7 +354,7 @@ public class CProjectSourceLocation implements IProjectSourceLocation private void initializeFolders() { final LinkedList list = new LinkedList(); - if ( getProject() != null ) + if ( getProject() != null && getProject().exists() ) { list.add( getProject() ); try @@ -379,7 +382,13 @@ public class CProjectSourceLocation implements IProjectSourceLocation { } } - fFolders = (IResource[])list.toArray( new IResource[list.size()] ); + synchronized( this ) + { + if ( fFolders == null ) + { + fFolders = (IResource[])list.toArray( new IResource[list.size()] ); + } + } } protected IResource[] getFolders()