Fixed some possible NPE of server.

This commit is contained in:
LevelX2 2014-09-07 22:01:38 +02:00
parent bb0be3aea3
commit 65fdaba28d
2 changed files with 36 additions and 29 deletions

View file

@ -700,6 +700,7 @@ public class TableController {
}
private void matchEnd() {
if (match != null) {
for (Entry<UUID, UUID> entry: userPlayerMap.entrySet()) {
MatchPlayer matchPlayer = match.getPlayer(entry.getValue());
// opponent(s) left during sideboarding
@ -734,6 +735,7 @@ public class TableController {
// free resources no longer needed
match.cleanUpOnMatchEnd(ConfigSettings.getInstance().isSaveGameActivated());
}
}
private synchronized void setupTimeout(int seconds) {
cancelTimeout();

View file

@ -231,6 +231,11 @@ class TableListSorter implements Comparator<Table> {
return 1; // two has higher priority
} else if (one.getEndTime() == null) {
if (two.getEndTime() == null) {
if (two.getStartTime() == null) {
return -1;
} else if (one.getStartTime() == null) {
return 1;
}
return two.getStartTime().compareTo(one.getStartTime());
} else {
return -1;