From 1248beb0b259327d60ed75171016bcacc8420856 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 24 Nov 2017 10:21:23 +0000 Subject: [PATCH] cachestats: Fix nil pointer if not a cache remote - fixes #1855 Also don't retry or show stats --- cmd/cachestats/cachestats.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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()) }