From 29a6c7b25ce9cbd27d1659f5fe991b00d7a8b611 Mon Sep 17 00:00:00 2001 From: Raghav Kaul Date: Wed, 20 Sep 2023 16:00:44 +0000 Subject: [PATCH] Fix npe Signed-off-by: Raghav Kaul --- clients/gitlabrepo/licenses.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/clients/gitlabrepo/licenses.go b/clients/gitlabrepo/licenses.go index 7b76963dde6..7208ff815c7 100644 --- a/clients/gitlabrepo/licenses.go +++ b/clients/gitlabrepo/licenses.go @@ -46,6 +46,11 @@ func (handler *licensesHandler) setup() error { handler.once.Do(func() { l := handler.glProject.License + // No registered license on GitLab repo, use file-based license detection instead + if l == nil { + return + } + ptn, err := regexp.Compile(fmt.Sprintf("%s/-/blob/(?:\\w+)/(.*)", handler.repourl.URI())) if err != nil { handler.errSetup = fmt.Errorf("couldn't parse license url: %w", err)