From 2ef565be990a39b96b920721db19f6b2d980ea95 Mon Sep 17 00:00:00 2001 From: Louis Royer Date: Thu, 28 Nov 2024 15:58:31 +0100 Subject: [PATCH] fix crash --- internal/app/pdu_session.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/app/pdu_session.go b/internal/app/pdu_session.go index b9df7b1..1ef050f 100644 --- a/internal/app/pdu_session.go +++ b/internal/app/pdu_session.go @@ -111,10 +111,17 @@ func (p *PduSessions) EstablishmentRequest(c *gin.Context) { logrus.WithFields(logrus.Fields{ "ue": ps.Ue.String(), "gnb": ps.Gnb.String(), + "dnn": ps.Dnn, }).Info("New PDU Session establishment Request") // allocate new ue ip addr - UeIpAddr, err := p.Pools[ps.Dnn].Next() + pool, ok := p.Pools[ps.Dnn] + if !ok { + logrus.Error("unknown pool") + c.JSON(http.StatusInternalServerError, jsonapi.MessageWithError{Message: "unknown pool", Error: nil}) + return + } + UeIpAddr, err := pool.Next() if err != nil { logrus.WithError(err).Error("no address available in pool") c.JSON(http.StatusInternalServerError, jsonapi.MessageWithError{Message: "no address available in pool", Error: err})