mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
fixed NPE
This commit is contained in:
parent
e8b5f3a029
commit
6b68d31e47
2 changed files with 22 additions and 18 deletions
|
@ -298,27 +298,29 @@ public final class ScannerConfigUtil {
|
|||
}
|
||||
|
||||
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 {
|
||||
String fileName = project.getPersistentProperty(discoveredScannerConfigFileNameProperty);
|
||||
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;
|
||||
project.setPersistentProperty(discoveredScannerConfigFileNameProperty, fileName);
|
||||
} catch (CoreException e) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,9 @@ public class DiscoveredPathManager implements IDiscoveredPathManager, IResourceC
|
|||
public void removeDiscoveredInfo(IProject project) {
|
||||
ScannerConfigUtil.getDiscoveredScannerConfigStore(project, true);
|
||||
DiscoveredPathInfo info = (DiscoveredPathInfo)fDiscoveredMap.remove(project);
|
||||
fireUpdate(INFO_REMOVED, info);
|
||||
if (info != null) {
|
||||
fireUpdate(INFO_REMOVED, info);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateDiscoveredInfo(IDiscoveredPathInfo info) throws CoreException {
|
||||
|
|
Loading…
Add table
Reference in a new issue