This commit is contained in:
maurer.it 2011-10-20 18:07:14 -04:00
commit 02188fe73a
5 changed files with 16 additions and 7 deletions

View file

@ -65,7 +65,7 @@ public class ChatSession {
}
public void kill(UUID userId) {
if (clients.containsKey(userId)) {
if (userId != null && clients.containsKey(userId)) {
String userName = clients.get(userId);
clients.remove(userId);
broadcast(userName, " has left", MessageColor.BLACK);

View file

@ -451,8 +451,11 @@ public class MageServerImpl implements MageServer {
@Override
public boolean isTableOwner(String sessionId, UUID roomId, UUID tableId) throws MageException {
try {
UUID userId = SessionManager.getInstance().getSession(sessionId).getUserId();
return TableManager.getInstance().isTableOwner(tableId, userId);
Session session = SessionManager.getInstance().getSession(sessionId);
if (session != null) {
UUID userId = SessionManager.getInstance().getSession(sessionId).getUserId();
return TableManager.getInstance().isTableOwner(tableId, userId);
}
}
catch (Exception ex) {
handleException(ex);

View file

@ -263,7 +263,8 @@ public class TableController {
else {
player = PlayerFactory.getInstance().createPlayer(playerType, name, options.getRange(), skill);
}
logger.info("Player created " + player.getId());
if (player != null)
logger.info("Player created " + player.getId());
return player;
}

View file

@ -119,7 +119,8 @@ public class User {
public synchronized void fireCallback(final ClientCallback call) {
if (isConnected()) {
Session session = SessionManager.getInstance().getSession(sessionId);
session.fireCallback(call);
if (session != null)
session.fireCallback(call);
}
}

View file

@ -217,11 +217,15 @@ public class TournamentController {
}
public void submitDeck(UUID playerId, Deck deck) {
tournamentSessions.get(playerId).submitDeck(deck);
if (tournamentSessions.containsKey(playerId)) {
tournamentSessions.get(playerId).submitDeck(deck);
}
}
public void updateDeck(UUID playerId, Deck deck) {
tournamentSessions.get(playerId).updateDeck(deck);
if (tournamentSessions.containsKey(playerId)) {
tournamentSessions.get(playerId).updateDeck(deck);
}
}
public void timeout(UUID userId) {