Skip to content

Commit

Permalink
fix: nil dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
yccodr committed Apr 25, 2024
1 parent 8210039 commit d866a36
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions internal/sbi/nssaiavailability/nssaiavailability_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func NfInstanceDelete(nfId string) *models.ProblemDetails {
}
}

*problemDetails = models.ProblemDetails{
problemDetails = &models.ProblemDetails{
Title: util.UNSUPPORTED_RESOURCE,
Status: http.StatusNotFound,
Detail: fmt.Sprintf("AMF ID '%s' does not exist", nfId),
Expand Down Expand Up @@ -81,7 +81,7 @@ func NfInstancePatch(nssaiAvailabilityUpdateInfo plugin.PatchDocument, nfId stri
}
factory.NssfConfig.RUnlock()
if !hitAmf {
*problemDetails = models.ProblemDetails{
problemDetails = &models.ProblemDetails{
Title: util.UNSUPPORTED_RESOURCE,
Status: http.StatusNotFound,
Detail: fmt.Sprintf("AMF ID '%s' does not exist", nfId),
Expand All @@ -108,7 +108,7 @@ func NfInstancePatch(nssaiAvailabilityUpdateInfo plugin.PatchDocument, nfId stri

patch, err := jsonpatch.DecodePatch(patchJSON)
if err != nil {
*problemDetails = models.ProblemDetails{
problemDetails = &models.ProblemDetails{
Title: util.MALFORMED_REQUEST,
Status: http.StatusBadRequest,
Detail: err.Error(),
Expand All @@ -118,7 +118,7 @@ func NfInstancePatch(nssaiAvailabilityUpdateInfo plugin.PatchDocument, nfId stri

modified, err := patch.Apply(original)
if err != nil {
*problemDetails = models.ProblemDetails{
problemDetails = &models.ProblemDetails{
Title: util.INVALID_REQUEST,
Status: http.StatusConflict,
Detail: err.Error(),
Expand All @@ -130,7 +130,7 @@ func NfInstancePatch(nssaiAvailabilityUpdateInfo plugin.PatchDocument, nfId stri
err = json.Unmarshal(modified, &factory.NssfConfig.Configuration.AmfList[amfIdx].SupportedNssaiAvailabilityData)
factory.NssfConfig.Unlock()
if err != nil {
*problemDetails = models.ProblemDetails{
problemDetails = &models.ProblemDetails{
Title: util.INVALID_REQUEST,
Status: http.StatusBadRequest,
Detail: err.Error(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func SubscriptionCreate(createData models.NssfEventSubscriptionCreateData) (
if err != nil {
logger.NssaiavailLog.Warnf(err.Error())

*problemDetails = models.ProblemDetails{
problemDetails = &models.ProblemDetails{
Title: util.UNSUPPORTED_RESOURCE,
Status: http.StatusNotFound,
Detail: err.Error(),
Expand Down Expand Up @@ -95,7 +95,7 @@ func SubscriptionUnsubscribe(subscriptionId string) *models.ProblemDetails {
}

// No specific subscription ID exists
*problemDetails = models.ProblemDetails{
problemDetails = &models.ProblemDetails{
Title: util.UNSUPPORTED_RESOURCE,
Status: http.StatusNotFound,
Detail: fmt.Sprintf("Subscription ID '%s' is not available", subscriptionId),
Expand Down

0 comments on commit d866a36

Please sign in to comment.