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:
parent
f8440ac182
commit
00f353d2c8
1 changed files with 3 additions and 1 deletions
|
@ -169,7 +169,9 @@ 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];
|
||||||
return new TreeSelection(path.getParentPath());
|
if (path.getSegmentCount() > 1) {
|
||||||
|
return new TreeSelection(path.getParentPath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return newSelection;
|
return newSelection;
|
||||||
|
|
Loading…
Add table
Reference in a new issue