Skip to content

Commit 2575c75

Browse files
fix: add nil check in unregister and unsubscribe (#270)
1 parent 2d77e36 commit 2575c75

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,9 @@ type RegisterResponse struct {
943943
}
944944

945945
func (r RegisterResponse) Unregister() error {
946+
if r.registration == nil {
947+
return fmt.Errorf("empty registration")
948+
}
946949
return r.registration.unregister()
947950
}
948951

@@ -952,6 +955,9 @@ type SubscribeResponse struct {
952955
}
953956

954957
func (r SubscribeResponse) Unsubscribe() error {
958+
if r.subscription == nil {
959+
return fmt.Errorf("empty subscription")
960+
}
955961
return r.subscription.unsubscribe()
956962
}
957963

0 commit comments

Comments
 (0)