From 1fcb6d4bedf07411a441fcdc92a2471e91d5c114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Papp?= Date: Wed, 12 Aug 2026 10:23:23 +0200 Subject: [PATCH] [client] Do not wrap a nil connection listener in the mobile bindings The listener adapter introduced with the network state work turned a nil listener into a non-nil peer.Listener holding a nil delegate, so the notifier's nil check passed it through and setListener panicked on its immediate OnAddressChanged callback. EngineRunner already forwards null, so the path is reachable. Drop the listener instead when it is nil, on Android and iOS alike. --- client/android/client.go | 4 ++++ client/ios/NetBirdSDK/client.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/client/android/client.go b/client/android/client.go index 666cfe5c4..5bbccda3d 100644 --- a/client/android/client.go +++ b/client/android/client.go @@ -538,6 +538,10 @@ func (c *Client) OnUpdatedHostDNS(list *DNSList) error { // SetConnectionListener set the network connection listener func (c *Client) SetConnectionListener(listener ConnectionListener) { + if listener == nil { + c.recorder.RemoveConnectionListener() + return + } c.recorder.SetConnectionListener(connectionListenerAdapter{listener}) } diff --git a/client/ios/NetBirdSDK/client.go b/client/ios/NetBirdSDK/client.go index 347b71ea5..350d68740 100644 --- a/client/ios/NetBirdSDK/client.go +++ b/client/ios/NetBirdSDK/client.go @@ -344,6 +344,10 @@ func (c *Client) GetStatusDetails() *StatusDetails { // SetConnectionListener set the network connection listener func (c *Client) SetConnectionListener(listener ConnectionListener) { + if listener == nil { + c.recorder.RemoveConnectionListener() + return + } c.recorder.SetConnectionListener(connectionListenerAdapter{listener}) }