From 94cf0b4bdbf20db70edd30d22eef3685954ec599 Mon Sep 17 00:00:00 2001 From: z4yx Date: Tue, 13 Aug 2019 23:07:01 +0800 Subject: [PATCH] fix possible null dereferencing, reported by #96 --- worker/provider.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/worker/provider.go b/worker/provider.go index 90c9c0e..780c0f1 100644 --- a/worker/provider.go +++ b/worker/provider.go @@ -119,10 +119,10 @@ func newMirrorProvider(mirror mirrorConfig, cfg *Config) mirrorProvider { env: mirror.Env, } p, err := newCmdProvider(pc) - p.isMaster = isMaster if err != nil { panic(err) } + p.isMaster = isMaster provider = p case provRsync: rc := rsyncConfig{ @@ -141,10 +141,10 @@ func newMirrorProvider(mirror mirrorConfig, cfg *Config) mirrorProvider { retry: mirror.Retry, } p, err := newRsyncProvider(rc) - p.isMaster = isMaster if err != nil { panic(err) } + p.isMaster = isMaster provider = p case provTwoStageRsync: rc := twoStageRsyncConfig{ @@ -163,10 +163,10 @@ func newMirrorProvider(mirror mirrorConfig, cfg *Config) mirrorProvider { retry: mirror.Retry, } p, err := newTwoStageRsyncProvider(rc) - p.isMaster = isMaster if err != nil { panic(err) } + p.isMaster = isMaster provider = p default: panic(errors.New("Invalid mirror provider"))