Fix missing groupId 0 entry in output from API call GET /chat/active/{address}

This commit is contained in:
catbref 2020-05-13 16:30:28 +01:00
parent f29ae656b9
commit ef790a8cb1

View File

@ -130,17 +130,16 @@ public class HSQLDBChatRepository implements ChatRepository {
List<GroupChat> groupChats = new ArrayList<>();
try (ResultSet resultSet = this.repository.checkedExecute(groupsSql, address)) {
if (resultSet == null)
return groupChats;
if (resultSet != null) {
do {
int groupId = resultSet.getInt(1);
String groupName = resultSet.getString(2);
long timestamp = resultSet.getLong(3);
do {
int groupId = resultSet.getInt(1);
String groupName = resultSet.getString(2);
long timestamp = resultSet.getLong(3);
GroupChat groupChat = new GroupChat(groupId, groupName, timestamp);
groupChats.add(groupChat);
} while (resultSet.next());
GroupChat groupChat = new GroupChat(groupId, groupName, timestamp);
groupChats.add(groupChat);
} while (resultSet.next());
}
} catch (SQLException e) {
throw new DataException("Unable to fetch active group chats from repository", e);
}