Things that should never happen, but are.

This commit is contained in:
T00thpick1 2013-05-18 22:15:32 -04:00
parent 2d66b8ed12
commit feb0d1fe5d

View File

@ -331,6 +331,11 @@ public class PlayerProfile {
"JOIN " + tablePrefix + "huds h ON (u.id = h.user_id) " + "JOIN " + tablePrefix + "huds h ON (u.id = h.user_id) " +
"WHERE u.user = '" + playerName + "'" "WHERE u.user = '" + playerName + "'"
).get(1); ).get(1);
// Should never happen but just in case
if (playerData == null || playerData.size() == 0) {
return false;
}
} }
userId = Integer.valueOf(playerData.get(0)); userId = Integer.valueOf(playerData.get(0));
@ -374,8 +379,20 @@ public class PlayerProfile {
// Acrobatics 35 - Unused // Acrobatics 35 - Unused
skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(playerData.get(36))); skillsDATS.put(AbilityType.BLAST_MINING, Integer.valueOf(playerData.get(36)));
try {
hudType = HudType.valueOf(playerData.get(37)); hudType = HudType.valueOf(playerData.get(37));
}
catch (Exception e) {
// Shouldn't happen unless database is being tampered with
hudType = HudType.STANDARD;
}
try {
mobHealthbarType = MobHealthbarType.valueOf(playerData.get(38)); mobHealthbarType = MobHealthbarType.valueOf(playerData.get(38));
}
catch (Exception e) {
mobHealthbarType = Config.getInstance().getMobHealthbarDefault();
}
loaded = true; loaded = true;
return true; return true;