fix: add nil guards to prevent nil-pointer panics
All checks were successful
CI / test (pull_request) Successful in 46s
CI / build (pull_request) Successful in 47s
CI / vet (pull_request) Successful in 59s

- document.go: check if resp is nil before calling resp.Status() in
  Refresh(), since Playwright's Reload() can return a nil response
- archive.go: check SelectFirst() results for nil before calling
  Type() and Click(), preventing panics when DOM elements are missing

Closes #10, #11

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-15 16:13:43 +00:00
parent 49f294e884
commit 6c68062e56
2 changed files with 13 additions and 3 deletions

View File

@@ -61,7 +61,7 @@ func (d *document) Refresh() error {
return fmt.Errorf("failed to reload page: %w", err)
}
if resp.Status() != 200 {
if resp != nil && resp.Status() != 200 {
return fmt.Errorf("invalid status code: %d", resp.Status())
}