From e4b3383d84cd181f4a9fec1097ec61e583d6f827 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Thu, 12 Feb 2026 01:05:52 +0700 Subject: brokenlinks: fix possible panic in markAsBroken If the Link does not have parentUrl, set the parent URL using the link URL itself. This only happened if the target URL that we will scan return an error. --- brokenlinks/worker.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/brokenlinks/worker.go b/brokenlinks/worker.go index 79ae796..ce109ed 100644 --- a/brokenlinks/worker.go +++ b/brokenlinks/worker.go @@ -245,7 +245,12 @@ func (wrk *worker) markAsBroken(linkq jarink.Link) { if slices.Contains(wrk.opts.ignoreStatus, linkq.StatusCode) { return } - var parentUrl = linkq.ParentUrl.String() + var parentUrl string + if linkq.ParentUrl == nil { + parentUrl = linkq.Url + } else { + parentUrl = linkq.ParentUrl.String() + } var listBroken = wrk.result.BrokenLinks[parentUrl] if linkq.ErrScan != nil { linkq.Error = linkq.ErrScan.Error() -- cgit v1.3