mirror of
https://github.com/kopia/kopia.git
synced 2026-02-24 18:37:11 -05:00
* Policy set: fix nil pointer dereference #385
This commit is contained in:
@@ -82,8 +82,12 @@ func setPolicy(ctx context.Context, rep *repo.Repository) error {
|
||||
|
||||
for _, target := range targets {
|
||||
p, err := policy.GetDefinedPolicy(ctx, rep, target)
|
||||
if err == policy.ErrPolicyNotFound {
|
||||
|
||||
switch {
|
||||
case err == policy.ErrPolicyNotFound:
|
||||
p = &policy.Policy{}
|
||||
case err != nil:
|
||||
return errors.Wrap(err, "could not get defined policy")
|
||||
}
|
||||
|
||||
printStderr("Setting policy for %v\n", target)
|
||||
|
||||
Reference in New Issue
Block a user