2 NPE fix

This commit is contained in:
Jascha Starke 2013-09-28 17:25:06 +02:00
parent 6db1664a7e
commit fd3c9da9ff
3 changed files with 8 additions and 3 deletions

View file

@ -219,8 +219,13 @@ public class DBQueries {
try { try {
switch (db.getType()) { switch (db.getType()) {
case SQLite: case SQLite:
return GameMode.getByValue(rs.getInt("gm")); int gm = rs.getInt("gm");
if (rs.wasNull())
return null;
return GameMode.getByValue(gm);
case MySQL: case MySQL:
if (rs.getString("gm") == null)
return null;
return GameMode.valueOf(rs.getString("gm")); return GameMode.valueOf(rs.getString("gm"));
default: default:
throw new RuntimeException("Unsupported Database-Type."); throw new RuntimeException("Unsupported Database-Type.");

View file

@ -115,7 +115,7 @@ public class SyncronizedModel extends AbstractModel implements DBModel {
@Override @Override
public boolean isRestricted(Block block) { public boolean isRestricted(Block block) {
BlockState state = getState(block); BlockState state = getState(block);
return state != null ? state.isRestricted() : null; return state != null ? state.isRestricted() : false;
} }
public BlockState getState(Block block) { public BlockState getState(Block block) {

View file

@ -36,7 +36,7 @@ command.blockstate.migration_finished: Database migration of {0} records success
command.blockstate.migration_finished_restart: A Server-Restart is required! command.blockstate.migration_finished_restart: A Server-Restart is required!
command.blockstate.migration_error: Migration failed with error: {0} command.blockstate.migration_error: Migration failed with error: {0}
command.blockstate.migrate_useronline_error: There are players on the Server. The migration shouldn't be run with active players. command.blockstate.migrate_useronline_error: There are players on the Server. The migration shouldn't be run with active players.
command.blockstate.migrate_confirm: Are you sure you want to start the Migration? It may take a very long time and much CPU. To confirm execution run the command with the following added: {0} command.blockstate.migrate_confirm: Are you sure you want to start the migration? It may take a very long time and much CPU. To confirm execution run the command with the following added: {0}
cmdblock.blocked: This command is blocked while in creative mode. cmdblock.blocked: This command is blocked while in creative mode.
cmdblock.blocked.requires_worldedit: WorlEdit is required to use this command cmdblock.blocked.requires_worldedit: WorlEdit is required to use this command