1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

fixed NPE

This commit is contained in:
David Inglis 2004-06-22 20:12:03 +00:00
parent e8b5f3a029
commit 6b68d31e47
2 changed files with 22 additions and 18 deletions

View file

@ -298,27 +298,29 @@ public final class ScannerConfigUtil {
} }
public static IPath getDiscoveredScannerConfigStore(IProject project, boolean delete) { public static IPath getDiscoveredScannerConfigStore(IProject project, boolean delete) {
if (project != null) { String fileName = null;
try {
fileName = project.getPersistentProperty(discoveredScannerConfigFileNameProperty);
} catch (CoreException e) {
MakeCorePlugin.log(e.getStatus());
}
if (fileName == null) {
fileName = String.valueOf(sRandom.nextLong()) + ".sc"; //$NON-NLS-1$
try { try {
String fileName = project.getPersistentProperty(discoveredScannerConfigFileNameProperty); project.setPersistentProperty(discoveredScannerConfigFileNameProperty, fileName);
if (fileName == null) {
fileName = String.valueOf(sRandom.nextLong()) + ".sc"; //$NON-NLS-1$
project.setPersistentProperty(discoveredScannerConfigFileNameProperty, fileName);
}
IPath path = MakeCorePlugin.getWorkingDirectory();
path = path.append(fileName);
if (delete) {
File file = path.toFile();
if (file.exists()) {
file.delete();
}
}
return path;
} catch (CoreException e) { } catch (CoreException e) {
MakeCorePlugin.log(e.getStatus()); MakeCorePlugin.log(e.getStatus());
} }
} }
return null;
IPath path = MakeCorePlugin.getWorkingDirectory();
path = path.append(fileName);
if (delete) {
File file = path.toFile();
if (file.exists()) {
file.delete();
}
}
return path;
} }
} }

View file

@ -121,7 +121,9 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
public void removeDiscoveredInfo(IProject project) { public void removeDiscoveredInfo(IProject project) {
ScannerConfigUtil.getDiscoveredScannerConfigStore(project, true); ScannerConfigUtil.getDiscoveredScannerConfigStore(project, true);
DiscoveredPathInfo info = (DiscoveredPathInfo)fDiscoveredMap.remove(project); DiscoveredPathInfo info = (DiscoveredPathInfo)fDiscoveredMap.remove(project);
fireUpdate(INFO_REMOVED, info); if (info != null) {
fireUpdate(INFO_REMOVED, info);
}
} }
public void updateDiscoveredInfo(IDiscoveredPathInfo info) throws CoreException { public void updateDiscoveredInfo(IDiscoveredPathInfo info) throws CoreException {