1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

[Bug 148003] [New Class Wizard] Browse for Folder can cause infinite loop

Problem reason: loop inside of NewClassWizardUtil.getSourceFolder().

After "path.removeLastSegments(1)" deletes the last segment, path
would contain "\", because (separators & HAS_LEADING) != 0)
So, "path.isEmpty()" treats it as root path and returns false.
That's why loop became infinite.

Fix:

-        while (!path.isEmpty()) {
+        while (path.segmentCount() > 0) {
This commit is contained in:
Oleg Krasilnikov 2006-06-21 11:50:10 +00:00
parent dafc8e4478
commit cd052ee5de

View file

@ -82,7 +82,7 @@ public class NewClassWizardUtil {
public static ICContainer getSourceFolder(IPath path) {
if (path == null)
return null;
while (!path.isEmpty()) {
while (path.segmentCount() > 0) {
IResource res = getWorkspaceRoot().findMember(path);
if (res != null && res.exists()) {
int resType = res.getType();