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

Add a guard for potential NPE.

This commit is contained in:
Pawel Piech 2009-04-23 22:38:10 +00:00
parent f8440ac182
commit 00f353d2c8

View file

@ -169,7 +169,9 @@ public class DefaultDsfSelectionPolicy implements IModelSelectionPolicy {
ITreeSelection treeSelection = (ITreeSelection)invalidSelection;
if (treeSelection.getPaths().length == 1) {
TreePath path = treeSelection.getPaths()[0];
return new TreeSelection(path.getParentPath());
if (path.getSegmentCount() > 1) {
return new TreeSelection(path.getParentPath());
}
}
}
return newSelection;