Skip to content

Commit

Permalink
chore: check if response is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
pf-lin committed Sep 16, 2024
1 parent ed63477 commit fb6ecbf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/sbi/consumer/amf_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (s *namfService) N1N2MessageTransfer(
}

rsp, err := client.N1N2MessageCollectionCollectionApi.N1N2MessageTransfer(ctx, n1n2MessageTransferRequest)
if err != nil {
if err != nil || rsp == nil {
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion internal/sbi/consumer/pcf_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (s *npcfService) SendSMPolicyAssociationCreate(smContext *smf_context.SMCon
}

smPolicyDecisionFromPCF, err := client.SMPoliciesCollectionApi.CreateSMPolicy(ctx, request)
if err != nil {
if err != nil || smPolicyDecisionFromPCF == nil {
return "", nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion internal/sbi/processor/association.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ func (p *Processor) requestAMFToReleasePDUResources(
rspData, err := p.Consumer().
N1N2MessageTransfer(ctx, smContext.Supi, n1n2Request, smContext.CommunicationClientApiPrefix)

if err != nil {
if err != nil || rspData == nil {
logger.ConsumerLog.Warnf("N1N2MessageTransfer for RequestAMFToReleasePDUResources failed: %+v", err)
// keep SM Context to avoid inconsistency with AMF
smContext.SetState(smf_context.InActive)
Expand Down
4 changes: 2 additions & 2 deletions internal/sbi/processor/datapath.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func (p *Processor) sendPDUSessionEstablishmentReject(
}
rspData, err := p.Consumer().
N1N2MessageTransfer(ctx, smContext.Supi, n1n2Request, smContext.CommunicationClientApiPrefix)
if err != nil {
if err != nil || rspData == nil {
logger.ConsumerLog.Warnf("N1N2MessageTransfer for SendPDUSessionEstablishmentReject failed: %+v", err)
return
}
Expand Down Expand Up @@ -331,7 +331,7 @@ func (p *Processor) sendPDUSessionEstablishmentAccept(

rspData, err := p.Consumer().
N1N2MessageTransfer(ctx, smContext.Supi, n1n2Request, smContext.CommunicationClientApiPrefix)
if err != nil {
if err != nil || rspData == nil {
logger.ConsumerLog.Warnf("N1N2MessageTransfer for sendPDUSessionEstablishmentAccept failed: %+v", err)
return
}
Expand Down

0 comments on commit fb6ecbf

Please sign in to comment.