From 7509c38dc0b24382c90817f865f1585cab3635d1 Mon Sep 17 00:00:00 2001 From: Francois G Date: Thu, 20 Apr 2023 18:47:15 +0200 Subject: [PATCH] Bug fix makeCompetion if fileName is not in the resultSet --- .../peeratcode/repository/DatabaseRepository.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/be/jeffcheasey88/peeratcode/repository/DatabaseRepository.java b/src/be/jeffcheasey88/peeratcode/repository/DatabaseRepository.java index 4b8c2f3..b079442 100644 --- a/src/be/jeffcheasey88/peeratcode/repository/DatabaseRepository.java +++ b/src/be/jeffcheasey88/peeratcode/repository/DatabaseRepository.java @@ -116,8 +116,12 @@ public class DatabaseRepository { } private Completion makeCompletion(int playerId, int puzzleId, ResultSet completionResult) throws SQLException { + String name = null; + if (hasColumn(completionResult, "fileName")) + name = completionResult.getString("fileName"); + return new Completion(playerId, puzzleId, completionResult.getInt("tries"), - completionResult.getString("fileName"), completionResult.getInt("score")); + name, completionResult.getInt("score")); } private Player makePlayer(ResultSet playerResult) throws SQLException {