Skip to content

Commit

Permalink
Checking if a message read from channel to prevent nil pointer derefe…
Browse files Browse the repository at this point in the history
…rence

Signed-off-by: gatici <[email protected]>
  • Loading branch information
gatici committed Dec 4, 2024
1 parent dd180ed commit 415a27d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion producer/ue_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,10 @@ func HandleRegistrationStatusUpdateRequest(request *httpwrapper.Request) *httpwr
var ueRegStatusUpdateRspData *models.UeRegStatusUpdateRspData
ue.EventChannel.UpdateSbiHandler(UeContextHandler)
ue.EventChannel.SubmitMessage(sbiMsg)
msg := <-sbiMsg.Result
msg, read := <-sbiMsg.Result
if !read {
return httpwrapper.NewResponse(http.StatusNoContent, nil, nil)
}
if msg.RespData != nil {
ueRegStatusUpdateRspData = msg.RespData.(*models.UeRegStatusUpdateRspData)
}
Expand Down

0 comments on commit 415a27d

Please sign in to comment.