From b887d1f7c0371e8a8eb7862e9ccc411d20e67ac9 Mon Sep 17 00:00:00 2001 From: Chris Eager <79161849+eager-signal@users.noreply.github.com> Date: Fri, 5 Dec 2025 09:54:58 -0600 Subject: [PATCH] Fix potentially null errorCode in switch --- .../textsecuregcm/subscriptions/StripeManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/subscriptions/StripeManager.java b/service/src/main/java/org/whispersystems/textsecuregcm/subscriptions/StripeManager.java index 4b3a87047..bef8afd58 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/subscriptions/StripeManager.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/subscriptions/StripeManager.java @@ -230,7 +230,9 @@ public class StripeManager implements CustomerAwareSubscriptionPaymentProcessor try { return stripeClient.v1().paymentIntents().create(builder.build(), commonOptions()); } catch (StripeException e) { - final String errorCode = StringUtils.lowerCase(e.getCode(), Locale.ROOT); + final String errorCode = e.getCode() == null + ? "unknown" + : e.getCode().toLowerCase(Locale.ROOT); switch (errorCode) { case "amount_too_small","amount_too_large" -> throw ExceptionUtils.wrap(new SubscriptionInvalidAmountException(errorCode));