mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
clean up some null checks
This commit is contained in:
parent
188a09b8fb
commit
7b4acbe386
3 changed files with 6 additions and 11 deletions
|
@ -942,7 +942,7 @@ public class TableController {
|
||||||
if (!(table.getState() == TableState.WAITING || table.getState() == TableState.STARTING || table.getState() == TableState.READY_TO_START)) {
|
if (!(table.getState() == TableState.WAITING || table.getState() == TableState.STARTING || table.getState() == TableState.READY_TO_START)) {
|
||||||
if (match == null) {
|
if (match == null) {
|
||||||
logger.warn("- Match table with no match:");
|
logger.warn("- Match table with no match:");
|
||||||
logger.warn("-- matchId:" + match.getId() + " [" + match.getName() + ']');
|
logger.warn("-- matchId:" + match.getId() + " , table : " + table.getId());
|
||||||
// return false;
|
// return false;
|
||||||
} else if (match.isDoneSideboarding() && match.getGame() == null) {
|
} else if (match.isDoneSideboarding() && match.getGame() == null) {
|
||||||
// no sideboarding and not active game -> match seems to hang (maybe the Draw bug)
|
// no sideboarding and not active game -> match seems to hang (maybe the Draw bug)
|
||||||
|
|
|
@ -266,13 +266,13 @@ public class GameController implements GameCallback {
|
||||||
|
|
||||||
public void join(UUID userId) {
|
public void join(UUID userId) {
|
||||||
UUID playerId = userPlayerMap.get(userId);
|
UUID playerId = userPlayerMap.get(userId);
|
||||||
Optional<User> user = UserManager.instance.getUser(userId);
|
if (playerId == null) {
|
||||||
if (userId == null || playerId == null) {
|
|
||||||
logger.fatal("Join game failed!");
|
logger.fatal("Join game failed!");
|
||||||
logger.fatal("- gameId: " + game.getId());
|
logger.fatal("- gameId: " + game.getId());
|
||||||
logger.fatal("- userId: " + userId);
|
logger.fatal("- userId: " + userId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Optional<User> user = UserManager.instance.getUser(userId);
|
||||||
if (!user.isPresent()) {
|
if (!user.isPresent()) {
|
||||||
logger.fatal("User not found : " + userId);
|
logger.fatal("User not found : " + userId);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -3,14 +3,14 @@ package mage.server.game;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import mage.MageException;
|
import mage.MageException;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author BetaSteward_at_googlemail.com
|
|
||||||
* @param <T>
|
* @param <T>
|
||||||
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class GameWorker<T> implements Callable {
|
public class GameWorker<T> implements Callable {
|
||||||
|
|
||||||
|
@ -40,12 +40,7 @@ public class GameWorker<T> implements Callable {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.fatal("GameWorker general exception [" + game.getId() + "] " + e.getMessage(), e);
|
LOGGER.fatal("GameWorker general exception [" + game.getId() + "] " + e.getMessage(), e);
|
||||||
if (e instanceof NullPointerException) {
|
if (e instanceof NullPointerException) {
|
||||||
if (e.getStackTrace() == null) {
|
LOGGER.info(e.getStackTrace());
|
||||||
LOGGER.info("Stack trace is null");
|
|
||||||
} else {
|
|
||||||
LOGGER.info("Null-Pointer-Exception: Stack trace");
|
|
||||||
LOGGER.info(e.getStackTrace());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (Error err) {
|
} catch (Error err) {
|
||||||
LOGGER.fatal("GameWorker general error [" + game.getId() + "] " + err, err);
|
LOGGER.fatal("GameWorker general error [" + game.getId() + "] " + err, err);
|
||||||
|
|
Loading…
Reference in a new issue