Skip to content

Commit

Permalink
Change nil subscription stats to return error
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhollingworth committed Sep 19, 2022
1 parent 50c816d commit 484b239
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ func (s *Subscription) StatsWithContext(ctx context.Context) (*ua.SubscriptionDi
return nil, err
}

if v == nil {
return nil, errors.Errorf("empty SubscriptionDiagnostics for sub=%d", s.SubscriptionID)
}

for _, eo := range v.Value().([]*ua.ExtensionObject) {
stat := eo.Value.(*ua.SubscriptionDiagnosticsDataType)

Expand Down

0 comments on commit 484b239

Please sign in to comment.