Skip to content

Commit

Permalink
feat(subscriberdb): Handle NW NGC config nil check correctly
Browse files Browse the repository at this point in the history
Signed-off-by: Moinuddin Khan <moinuddin.khan@wavelabs.ai>
  • Loading branch information
moinuddin1980 committed Jun 25, 2022
1 parent 72e85c8 commit 7189f05
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lte/cloud/go/services/subscriberdb/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,19 @@ func LoadSuciProtos(ctx context.Context, networkID string) ([]*lte_protos.SuciPr
return nil, fmt.Errorf("network loading failed: %w", err)
}

suciProtos := []*lte_protos.SuciProfile{}

ngcModel := &lte_models.NetworkNgcConfigs{}
ngcConfig := ngcModel.GetFromNetwork(network).(*lte_models.NetworkNgcConfigs)
ngcConfig := ngcModel.GetFromNetwork(network)
if ngcConfig == nil {
return nil, fmt.Errorf("ngcConfig is nil: %w", err)
return suciProtos, fmt.Errorf("ngcConfig is nil: %w", err)
}

suciProfiles := ngcConfig.SuciProfiles
suciProtos := []*lte_protos.SuciProfile{}
for _, suciProfile := range suciProfiles {
suciProtos = append(suciProtos, ngcModel.ConvertSuciEntsToProtos(suciProfile))
if ngcConfig.(*lte_models.NetworkNgcConfigs) != nil {
suciProfiles := ngcConfig.(*lte_models.NetworkNgcConfigs).SuciProfiles
for _, suciProfile := range suciProfiles {
suciProtos = append(suciProtos, ngcModel.ConvertSuciEntsToProtos(suciProfile))
}
}

return suciProtos, nil
Expand Down

0 comments on commit 7189f05

Please sign in to comment.