fix: Database return null if object does not exist

This commit is contained in:
Simon Giesel 2020-05-27 11:29:24 +02:00
parent bc338ed4cf
commit cd3b4db3f4

View file

@ -77,6 +77,9 @@ public class Database {
try { try {
final Statement s = this.conn.createStatement(); final Statement s = this.conn.createStatement();
final ResultSet rs = s.executeQuery("SELECT " + type + " FROM playercache WHERE `player` ='" + uuid + "';"); final ResultSet rs = s.executeQuery("SELECT " + type + " FROM playercache WHERE `player` ='" + uuid + "';");
if (rs.next() == false) {
return null;
}
final Object obj = rs.getObject(type); final Object obj = rs.getObject(type);
s.close(); s.close();
return obj; return obj;