mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-24 15:07:56 +01:00
considering possibility of null positions
This commit is contained in:
parent
37b2cc7466
commit
72ee23849f
@ -10,9 +10,17 @@ public class VerticalPositionComparator implements Comparator<TopicType> {
|
||||
public int compare(TopicType o1, TopicType o2) {
|
||||
final String myPosition = o1.getPosition();
|
||||
final String otherPosition = o2.getPosition();
|
||||
int result;
|
||||
if (otherPosition == null) {
|
||||
result = -1;
|
||||
} else if (myPosition == null) {
|
||||
result = 1;
|
||||
} else {
|
||||
int myPositionY = Integer.parseInt(myPosition.split(",")[1]);
|
||||
int otherPositionY = Integer.parseInt(otherPosition.split(",")[1]);
|
||||
return myPositionY - otherPositionY;
|
||||
result = myPositionY - otherPositionY;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user