1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 06:45:43 +02:00

Fix for NPE in IndexEncoderUtil.calculateIndexFlags

This commit is contained in:
Vladimir Hirsl 2005-03-30 05:55:30 +00:00
parent 5a3d496550
commit 0861c2c64f
2 changed files with 15 additions and 7 deletions

View file

@ -1,3 +1,8 @@
2005-03-30 Vladimir Hirsl
Fix for NPE in IndexEncoderUtil.calculateIndexFlags
* index/org/eclipse/cdt/internal/core/index/domsourceindexer/IndexEncoderUtil.java
2005-03-29 Vladimir Hirsl
Problem markers for DOM AST based indexer.

View file

@ -86,22 +86,25 @@ public class IndexEncoderUtil {
}
if (fileName != null) {
//We are not in the file that has triggered the index. Thus, we need to find the
//file number for the current file (if it has one). If the current file does not
//have a file number, we need to add it to the index.
IFile tempFile = CCorePlugin.getWorkspace().getRoot().getFileForLocation(new Path(fileName));
String filePath = ""; //$NON-NLS-1$
if (tempFile != null){
//File is local to workspace
filePath = tempFile.getFullPath().toString();
}
else{
//File is external to workspace
else {
//File is external to workspace
IFile[] externalFiles = CCorePlugin.getWorkspace().getRoot().findFilesForLocation(new Path(fileName));
if (externalFiles.length > 0)
tempFile = externalFiles[0];
filePath = fileName;
}
if (!tempFile.equals(indexer.getResourceFile())) {
IndexedFile indFile = indexer.getOutput().getIndexedFile(filePath);
if (tempFile != null && !tempFile.equals(indexer.getResourceFile())) {
//We are not in the file that has triggered the index. Thus, we need to find the
//file number for the current file (if it has one). If the current file does not
//have a file number, we need to add it to the index.
IndexedFile indFile = indexer.getOutput().getIndexedFile(filePath);
if (indFile != null){
fileNum = indFile.getFileNumber();
}