From c9691849be5bc35476ec192d911a0f97ccce8261 Mon Sep 17 00:00:00 2001 From: neagix Date: Thu, 11 Jun 2026 17:25:13 +0200 Subject: [PATCH] Fix NPE in endCall when deviceId is null HangupMessage requires a non-null deviceId, but deviceId is only set once the remote peer's offer is received. If the call ends before the offer arrives (e.g. tunnel fails to spawn), deviceId is null and the HangupMessage constructor throws a NullPointerException. Guard the hangup send with a deviceId != null check so the protocol message is only sent when there is a known remote device to address. --- .../java/org/asamk/signal/manager/helper/CallManager.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/src/main/java/org/asamk/signal/manager/helper/CallManager.java b/lib/src/main/java/org/asamk/signal/manager/helper/CallManager.java index ac0a2a49..c1292646 100644 --- a/lib/src/main/java/org/asamk/signal/manager/helper/CallManager.java +++ b/lib/src/main/java/org/asamk/signal/manager/helper/CallManager.java @@ -706,8 +706,11 @@ public class CallManager implements AutoCloseable { fireCallEvent(state, reason); logger.debug("Call {} ended: {}", callIdUnsigned(callId), reason); - // Send Signal protocol hangup to remote peer (unless they initiated the end) - if (!"remote_hangup".equals(reason) + // Send Signal protocol hangup to remote peer (unless they initiated the end). + // Skip if deviceId is null: no offer was exchanged yet (e.g. tunnel failed to spawn), + // so there is no remote device to notify. + if (state.deviceId != null + && !"remote_hangup".equals(reason) && !"rejected".equals(reason) && !"remote_busy".equals(reason) && !"ringrtc_hangup".equals(reason)) {