From a36c4b7a9a3719b3b08f4102961b0fbdf101f7d4 Mon Sep 17 00:00:00 2001 From: "lilong.129" Date: Tue, 30 May 2023 14:48:04 +0800 Subject: [PATCH] fix: avoid panic when ActionOptions is nil --- hrp/pkg/uixt/action.go | 4 ++++ hrp/pkg/uixt/video_crawler.go | 1 + 2 files changed, 5 insertions(+) diff --git a/hrp/pkg/uixt/action.go b/hrp/pkg/uixt/action.go index 5e762e11..be503b62 100644 --- a/hrp/pkg/uixt/action.go +++ b/hrp/pkg/uixt/action.go @@ -106,6 +106,10 @@ type ActionOptions struct { func (o *ActionOptions) Options() []ActionOption { options := make([]ActionOption, 0) + if o == nil { + return options + } + if o.Identifier != "" { options = append(options, WithIdentifier(o.Identifier)) } diff --git a/hrp/pkg/uixt/video_crawler.go b/hrp/pkg/uixt/video_crawler.go index 94048787..3f7da689 100644 --- a/hrp/pkg/uixt/video_crawler.go +++ b/hrp/pkg/uixt/video_crawler.go @@ -447,6 +447,7 @@ var popups = [][]string{ {".*青少年.*", "我知道了"}, // 青少年弹窗 {".*个人信息保护.*", "同意"}, {".*更新.*", "以后再说"}, + {".*定位.*", ".*允许.*"}, } func (dExt *DriverExt) autoPopupHandler(ocrResult *OcrResult) error {