Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

cachestats: Fix nil pointer if not a cache remote - fixes #1855

Nick Craig-Wood1248beb0b259
diff --git a/cmd/cachestats/cachestats.go b/cmd/cachestats/cachestats.go
index 9130c5630..58039ec64 100644
--- a/cmd/cachestats/cachestats.go
+++ b/cmd/cachestats/cachestats.go
@@ -38,11 +38,14 @@ Print cache stats for a remote in JSON format
}
fsrc := cmd.NewFsSrc(args)
- cmd.Run(true, true, command, func() error {
+ cmd.Run(false, false, command, func() error {
var fsCache *cache.Fs
fsCache, ok := fsrc.(*cache.Fs)
if !ok {
- fsCache, ok = fsrc.Features().UnWrap().(*cache.Fs)
+ unwrap := fsrc.Features().UnWrap
+ if unwrap != nil {
+ fsCache, ok = unwrap().(*cache.Fs)
+ }
if !ok {
return errors.Errorf("%s: is not a cache remote", fsrc.Name())
}