1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +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,9 +169,11 @@ public class DefaultDsfSelectionPolicy implements IModelSelectionPolicy {
ITreeSelection treeSelection = (ITreeSelection)invalidSelection; ITreeSelection treeSelection = (ITreeSelection)invalidSelection;
if (treeSelection.getPaths().length == 1) { if (treeSelection.getPaths().length == 1) {
TreePath path = treeSelection.getPaths()[0]; TreePath path = treeSelection.getPaths()[0];
if (path.getSegmentCount() > 1) {
return new TreeSelection(path.getParentPath()); return new TreeSelection(path.getParentPath());
} }
} }
}
return newSelection; return newSelection;
} }