From 3483d2c07d8f9f41599a4c9f40448327191488af Mon Sep 17 00:00:00 2001 From: thinkerou Date: Sat, 27 Mar 2021 20:37:01 +0800 Subject: [PATCH] remove nil statement --- context.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/context.go b/context.go index 037ea8fe..1ba0fa2b 100644 --- a/context.go +++ b/context.go @@ -767,14 +767,12 @@ func (c *Context) RemoteIP() (net.IP, bool) { return nil, false } - trustedCIDRs, err := c.engine.prepareTrustedCIDRs() - if err == nil { - c.engine.trustedCIDRs = trustedCIDRs - if c.engine.trustedCIDRs != nil { - for _, cidr := range c.engine.trustedCIDRs { - if cidr.Contains(remoteIP) { - return remoteIP, true - } + trustedCIDRs, _ := c.engine.prepareTrustedCIDRs() + c.engine.trustedCIDRs = trustedCIDRs + if c.engine.trustedCIDRs != nil { + for _, cidr := range c.engine.trustedCIDRs { + if cidr.Contains(remoteIP) { + return remoteIP, true } } }