Fixed possible npe in debug info generation.

This commit is contained in:
LevelX2 2014-09-07 15:44:21 +02:00
parent a42a03355e
commit da44199b3d
2 changed files with 12 additions and 12 deletions

View file

@ -747,12 +747,12 @@ class TableTableModel extends AbstractTableModel {
case 9:
switch (tables[arg0].getTableState()) {
// case WAITING:
// String owner = tables[arg0].getControllerName();
// if (session != null && owner.equals(session.getUserName())) {
// return "Remove";
// }
// return "Join";
case WAITING:
String owner = tables[arg0].getControllerName();
if (session != null && owner.equals(session.getUserName())) {
return "";
}
return "Join";
case CONSTRUCTING:
case DRAFTING:
if (tables[arg0].isTournament()) {
@ -762,10 +762,10 @@ class TableTableModel extends AbstractTableModel {
if (tables[arg0].isTournament()) {
return "Show";
} else {
// String owner = tables[arg0].getControllerName();
// if (session != null && owner.equals(session.getUserName())) {
// return "Remove";
// }
owner = tables[arg0].getControllerName();
if (session != null && owner.equals(session.getUserName())) {
return "";
}
return "Watch";
}
default:

View file

@ -207,7 +207,7 @@ public class TableManager {
}
public boolean removeTable(UUID userId, UUID tableId) {
if (UserManager.getInstance().isAdmin(userId)) {
if (isTableOwner(tableId, userId) || UserManager.getInstance().isAdmin(userId)) {
logger.debug("Table remove request - userId: " + userId + " tableId: " + tableId);
TableController tableController = controllers.get(tableId);
if (tableController != null) {
@ -386,7 +386,7 @@ public class TableManager {
try {
if (!table.getState().equals(TableState.FINISHED)) {
// remove tables and games not valid anymore
logger.debug(table.getId() + " [" + table.getName()+ "] " + formatter.format(table.getStartTime()) +" (" + table.getState().toString() + ") " + (table.isTournament() ? "- Tournament":""));
logger.debug(table.getId() + " [" + table.getName()+ "] " + formatter.format(table.getStartTime() == null ? table.getCreateTime() : table.getCreateTime()) +" (" + table.getState().toString() + ") " + (table.isTournament() ? "- Tournament":""));
TableController tableController = getController(table.getId());
if (tableController != null) {
if (table.isTournament()) {