mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
popDirectory() make sure the stack is not empty
This commit is contained in:
parent
e2c5db0b47
commit
04682bb2bc
1 changed files with 6 additions and 6 deletions
|
@ -90,7 +90,7 @@ public class ErrorParserManager extends OutputStream {
|
|||
}
|
||||
// Fallback to the Project Location
|
||||
// FIXME: if the build did not start in the Project ?
|
||||
return fProject.getLocation();
|
||||
return fBaseDirectory;
|
||||
}
|
||||
|
||||
public void pushDirectory(IPath dir) {
|
||||
|
@ -99,8 +99,7 @@ public class ErrorParserManager extends OutputStream {
|
|||
if (fBaseDirectory.isPrefixOf(dir)) {
|
||||
int segments = fBaseDirectory.matchingFirstSegments(dir);
|
||||
pwd = dir.removeFirstSegments(segments);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
pwd = dir;
|
||||
}
|
||||
fDirectoryStack.addElement(pwd);
|
||||
|
@ -109,12 +108,13 @@ public class ErrorParserManager extends OutputStream {
|
|||
|
||||
public IPath popDirectory() {
|
||||
int i = fDirectoryStack.size();
|
||||
IPath dir = (IPath) fDirectoryStack.lastElement();
|
||||
if (i != 0) {
|
||||
IPath dir = (IPath) fDirectoryStack.lastElement();
|
||||
fDirectoryStack.removeElementAt(i - 1);
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
return new Path("");
|
||||
}
|
||||
|
||||
public int getDirectoryLevel() {
|
||||
return fDirectoryStack.size();
|
||||
|
|
Loading…
Add table
Reference in a new issue