Skip to content

Commit

Permalink
🐛 Fix npe for GitLab repos without license API data (#3500)
Browse files Browse the repository at this point in the history
Signed-off-by: Raghav Kaul <raghavkaul@google.com>
  • Loading branch information
raghavkaul authored Sep 20, 2023
1 parent fe7906f commit 0ce62a8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions clients/gitlabrepo/licenses.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0ce62a8

Please sign in to comment.