1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

popDirectory() make sure the stack is not empty

This commit is contained in:
Alain Magloire 2002-12-20 21:13:47 +00:00
parent e2c5db0b47
commit 04682bb2bc

View file

@ -90,7 +90,7 @@ public class ErrorParserManager extends OutputStream {
} }
// Fallback to the Project Location // Fallback to the Project Location
// FIXME: if the build did not start in the Project ? // FIXME: if the build did not start in the Project ?
return fProject.getLocation(); return fBaseDirectory;
} }
public void pushDirectory(IPath dir) { public void pushDirectory(IPath dir) {
@ -99,8 +99,7 @@ public class ErrorParserManager extends OutputStream {
if (fBaseDirectory.isPrefixOf(dir)) { if (fBaseDirectory.isPrefixOf(dir)) {
int segments = fBaseDirectory.matchingFirstSegments(dir); int segments = fBaseDirectory.matchingFirstSegments(dir);
pwd = dir.removeFirstSegments(segments); pwd = dir.removeFirstSegments(segments);
} } else {
else {
pwd = dir; pwd = dir;
} }
fDirectoryStack.addElement(pwd); fDirectoryStack.addElement(pwd);
@ -109,11 +108,12 @@ public class ErrorParserManager extends OutputStream {
public IPath popDirectory() { public IPath popDirectory() {
int i = fDirectoryStack.size(); int i = fDirectoryStack.size();
IPath dir = (IPath) fDirectoryStack.lastElement(); if (i != 0) {
if (i != 0) { IPath dir = (IPath) fDirectoryStack.lastElement();
fDirectoryStack.removeElementAt(i - 1); fDirectoryStack.removeElementAt(i - 1);
return dir;
} }
return dir; return new Path("");
} }
public int getDirectoryLevel() { public int getDirectoryLevel() {