From ce512e29a2244e26ad270632b3ff54494bbeb62f Mon Sep 17 00:00:00 2001 From: Hedzr Yeh Date: Wed, 2 Feb 2022 10:27:56 +0800 Subject: [PATCH] fix: slice index overflow for invalid input, just raised in our strict testing case, it shouldn't be thrown in end user typing. --- ptpkg.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ptpkg.go b/ptpkg.go index 4ad26ea..85f0d3c 100755 --- a/ptpkg.go +++ b/ptpkg.go @@ -355,7 +355,7 @@ func (pkg *ptpkg) processExternalTool() (err error) { } func (pkg *ptpkg) xxSet(keyPath string, v interface{}) { - if pkg.a[0] == '~' { + if len(pkg.a) > 0 && pkg.a[0] == '~' { pkg.store().SetNx(keyPath, v) } else { pkg.store().Set(keyPath, v)