From 733c14bbc8d7b89b58c972a2ac7d332f04985179 Mon Sep 17 00:00:00 2001 From: AsamK Date: Tue, 17 Oct 2023 14:19:32 +0200 Subject: [PATCH] Ignore invalid recipient numbers --- .../signal/manager/storage/recipients/RecipientStore.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/src/main/java/org/asamk/signal/manager/storage/recipients/RecipientStore.java b/lib/src/main/java/org/asamk/signal/manager/storage/recipients/RecipientStore.java index 62ab525a..9731496e 100644 --- a/lib/src/main/java/org/asamk/signal/manager/storage/recipients/RecipientStore.java +++ b/lib/src/main/java/org/asamk/signal/manager/storage/recipients/RecipientStore.java @@ -395,6 +395,14 @@ public class RecipientStore implements RecipientIdCreator, RecipientResolver, Re try (final var statement = connection.prepareStatement(sql)) { return Utils.executeQueryForStream(statement, resultSet -> resultSet.getString("number")) .filter(Objects::nonNull) + .filter(n -> { + try { + Long.parseLong(n); + return true; + } catch (NumberFormatException e) { + return false; + } + }) .collect(Collectors.toSet()); } } catch (SQLException e) {