NONRTRIC-946: Fix panics in Capif
[nonrtric/plt/sme.git] / capifcore / internal / publishservice / publishservice.go
index b4e38e7..0fa125f 100644 (file)
@@ -233,7 +233,8 @@ func (ps *PublishService) GetApfIdServiceApisServiceApiId(ctx echo.Context, apfI
 
 func getServiceDescription(serviceApiId string, descriptions []publishapi.ServiceAPIDescription) (int, *publishapi.ServiceAPIDescription) {
        for pos, description := range descriptions {
-               if serviceApiId == *description.ApiId {
+               // Check for nil as we had a failure here when running unit tests in parallel against a single Capifcore instance
+               if (description.ApiId != nil) && (serviceApiId == *description.ApiId) {
                        return pos, &description
                }
        }