From ff7fa278f60e466b9d48ba71c4be98a9ea3c01c6 Mon Sep 17 00:00:00 2001 From: imlonghao Date: Sun, 6 Sep 2020 01:40:06 +0800 Subject: [PATCH] fix(options): add validation for verify mode If verify mode is used but stdin is empty, program will raise panic --- core/options.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/options.go b/core/options.go index f00e7a1..13e5363 100644 --- a/core/options.go +++ b/core/options.go @@ -106,6 +106,9 @@ func ParseOptions() *Options { if options.FileName != "" && !FileExists(options.FileName) { gologger.Fatalf("文件:%s 不存在!\n", options.FileName) } + if !options.Stdin && options.Verify && options.FileName == "" { + gologger.Fatalf("启用了 -verify 参数但传入域名为空!") + } return options } func hasStdin() bool {