Skip to content

Commit 018ab4a

Browse files
authored
Fix segmentation violation when stat returns nil
1 parent 54d6a8a commit 018ab4a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

command/cp.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -864,6 +864,11 @@ func (c Copy) shouldOverride(ctx context.Context, srcurl *url.URL, dsturl *url.U
864864
return err
865865
}
866866

867+
// if source not exists, cannot proceed with comparison
868+
if srcObj == nil {
869+
return fmt.Errorf("stat on source object returned nil")
870+
}
871+
867872
dstClient, err := storage.NewClient(ctx, dsturl, c.storageOpts)
868873
if err != nil {
869874
return err

0 commit comments

Comments
 (0)