mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-13 02:17:55 +01:00
considering possibility of null positions
This commit is contained in:
parent
b45f874ce4
commit
d8e255cac8
@ -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 myPositionY = Integer.parseInt(myPosition.split(",")[1]);
|
||||
int otherPositionY = Integer.parseInt(otherPosition.split(",")[1]);
|
||||
return myPositionY - otherPositionY;
|
||||
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]);
|
||||
result = myPositionY - otherPositionY;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user