From 018ab4a1b78d6af3a6f013cffbc230c15c052640 Mon Sep 17 00:00:00 2001 From: Wes Date: Sun, 5 Oct 2025 13:28:16 -0700 Subject: [PATCH] Fix segmentation violation when stat returns nil --- command/cp.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/command/cp.go b/command/cp.go index 7ed06bfee..1b91d1d94 100644 --- a/command/cp.go +++ b/command/cp.go @@ -864,6 +864,11 @@ func (c Copy) shouldOverride(ctx context.Context, srcurl *url.URL, dsturl *url.U return err } + // if source not exists, cannot proceed with comparison + if srcObj == nil { + return fmt.Errorf("stat on source object returned nil") + } + dstClient, err := storage.NewClient(ctx, dsturl, c.storageOpts) if err != nil { return err