Calling code assumes the pair never null and uses -1 to signify not found.

This commit is contained in:
Arthur Charlton
2023-07-05 14:12:42 -04:00
parent c9d551cd39
commit cfb5fc25c3

View File

@@ -92,14 +92,15 @@ public class DueyProcessor {
}
private static Pair<Integer, Integer> getAccountCharacterIdFromCNAME(String name) {
Pair<Integer, Integer> ids = null;
Pair<Integer, Integer> ids = new Pair<>(-1, -1);
try (Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id,accountid FROM characters WHERE name = ?")) {
ps.setString(1, name);
try (ResultSet rs = ps.executeQuery()) {
if (rs.next()) {
ids = new Pair<>(rs.getInt("accountid"), rs.getInt("id"));
ids.left = rs.getInt("accountid");
ids.right = rs.getInt("id");
}
}
} catch (SQLException e) {