From 3de5af06112303d7875636db2257c3e86eb27cce Mon Sep 17 00:00:00 2001 From: RPRX <63339210+rprx@users.noreply.github.com> Date: Mon, 8 Mar 2021 18:12:38 +0000 Subject: [PATCH] Fix https://github.com/XTLS/Xray-core/issues/350 --- common/errors/errors.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/common/errors/errors.go b/common/errors/errors.go index b7941f1d..6dfb8a45 100644 --- a/common/errors/errors.go +++ b/common/errors/errors.go @@ -40,10 +40,8 @@ func (err *Error) pkgPath() string { return "" } path := reflect.TypeOf(err.pathObj).PkgPath() - for i := 0; i < len(path); i++ { - if path[i] == '/' { - return path[trim:] - } + if len(path) >= trim { + return path[trim:] } return path }