fix: add nil guards to prevent nil-pointer panics
- 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:
@@ -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())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user