fix: Database return null if object does not exist
This commit is contained in:
parent
bc338ed4cf
commit
cd3b4db3f4
1 changed files with 3 additions and 0 deletions
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue