Browse Source

fix nil pointer dereference: check err first

WANG Ziqin 6 năm trước cách đây
mục cha
commit
30259da0f0
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      worker/provider.go

+ 1 - 1
worker/provider.go

@@ -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{