Skip to content
Snippets Groups Projects
Commit f44ef123 authored by Simon Barner's avatar Simon Barner
Browse files

- Prevent potential NPE

refs 2189,1841
parent 56f21745
Branches
Tags
No related merge requests found
......@@ -43,7 +43,15 @@ public class HierarchicalNameComparator extends ViewerComparator {
// ... and compare them by name...
if(o1 instanceof INamedElement && o2 instanceof INamedElement) {
// Elements are at the same level -> compare by name
int rval = (((INamedElement)o1).getName().compareTo(((INamedElement)o2).getName()));
String name1 = ((INamedElement)o1).getName();
String name2 = ((INamedElement)o2).getName();
if(name1 == null) {
name1 = "";
}
if(name2 == null) {
name2 = "";
}
int rval = name1.compareTo(name2);
if(rval != 0) {
return rval;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment