From 61ab7653910727ff673070f36a34bed75204fc67 Mon Sep 17 00:00:00 2001 From: Jon Chambers Date: Thu, 29 Jan 2026 17:07:56 -0500 Subject: [PATCH] Require that `LinkDeviceRequest` has non-null account attributes --- .../textsecuregcm/entities/LinkDeviceRequest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/entities/LinkDeviceRequest.java b/service/src/main/java/org/whispersystems/textsecuregcm/entities/LinkDeviceRequest.java index 66c8bcc98..c7a6081e2 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/entities/LinkDeviceRequest.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/entities/LinkDeviceRequest.java @@ -17,6 +17,7 @@ public record LinkDeviceRequest(@Schema(requiredMode = Schema.RequiredMode.REQUI @NotBlank String verificationCode, + @NotNull @Valid AccountAttributes accountAttributes, @@ -44,7 +45,7 @@ public record LinkDeviceRequest(@Schema(requiredMode = Schema.RequiredMode.REQUI @AssertTrue @Schema(hidden = true) public boolean isExactlyOneMessageDeliveryChannel() { - if (accountAttributes.getFetchesMessages()) { + if (accountAttributes != null && accountAttributes.getFetchesMessages()) { return deviceActivationRequest().apnToken().isEmpty() && deviceActivationRequest().gcmToken().isEmpty(); } else { return deviceActivationRequest().apnToken().isPresent() ^ deviceActivationRequest().gcmToken().isPresent();