mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-03 22:35:43 +02:00
Fix for NPE in IndexEncoderUtil.calculateIndexFlags
This commit is contained in:
parent
5a3d496550
commit
0861c2c64f
2 changed files with 15 additions and 7 deletions
|
@ -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
|
2005-03-29 Vladimir Hirsl
|
||||||
Problem markers for DOM AST based indexer.
|
Problem markers for DOM AST based indexer.
|
||||||
|
|
||||||
|
|
|
@ -86,22 +86,25 @@ public class IndexEncoderUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fileName != null) {
|
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));
|
IFile tempFile = CCorePlugin.getWorkspace().getRoot().getFileForLocation(new Path(fileName));
|
||||||
String filePath = ""; //$NON-NLS-1$
|
String filePath = ""; //$NON-NLS-1$
|
||||||
if (tempFile != null){
|
if (tempFile != null){
|
||||||
//File is local to workspace
|
//File is local to workspace
|
||||||
filePath = tempFile.getFullPath().toString();
|
filePath = tempFile.getFullPath().toString();
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
//File is external to workspace
|
//File is external to workspace
|
||||||
|
IFile[] externalFiles = CCorePlugin.getWorkspace().getRoot().findFilesForLocation(new Path(fileName));
|
||||||
|
if (externalFiles.length > 0)
|
||||||
|
tempFile = externalFiles[0];
|
||||||
filePath = fileName;
|
filePath = fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tempFile.equals(indexer.getResourceFile())) {
|
if (tempFile != null && !tempFile.equals(indexer.getResourceFile())) {
|
||||||
IndexedFile indFile = indexer.getOutput().getIndexedFile(filePath);
|
//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){
|
if (indFile != null){
|
||||||
fileNum = indFile.getFileNumber();
|
fileNum = indFile.getFileNumber();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue