From 9ec27e0b82e0642ef6ad83c3d0ee38f54aee125a Mon Sep 17 00:00:00 2001 From: Louis Royer Date: Thu, 5 Sep 2024 17:32:24 +0200 Subject: [PATCH] Avoid segfault --- pfcp/entity.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pfcp/entity.go b/pfcp/entity.go index fa29782..5ea2f6f 100644 --- a/pfcp/entity.go +++ b/pfcp/entity.go @@ -51,7 +51,9 @@ func (oc *onceClosePfcpConn) Close() error { } func (oc *onceClosePfcpConn) close() { - oc.closeErr = oc.PFCPConn.Close() + if oc.PFCPConn != nil { + oc.closeErr = oc.PFCPConn.Close() + } } func (e *PFCPEntity) registerPfcpConn(conn *onceClosePfcpConn) {