From 99682ecbdb7dc61987bece4b89394d96559592e8 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 3 Mar 2017 20:37:04 -0800 Subject: [PATCH] admin: HealObjectInfo can be nil skip it. (#2059) Fixes #2058 --- cmd/admin-heal-list.go | 4 ++++ cmd/admin-heal.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/cmd/admin-heal-list.go b/cmd/admin-heal-list.go index fd876b0d..47d189f2 100644 --- a/cmd/admin-heal-list.go +++ b/cmd/admin-heal-list.go @@ -205,6 +205,10 @@ func mainAdminHealList(ctx *cli.Context) error { errorIf(probe.NewError(obj.Err), "Cannot heal object `"+obj.Key+"`.") continue } + // Skip for non-recursive use case. + if obj.HealObjectInfo == nil { + continue + } printMsg(healListMessage{Bucket: currBucket, Object: obj}) } } diff --git a/cmd/admin-heal.go b/cmd/admin-heal.go index 005b816f..58229ff4 100644 --- a/cmd/admin-heal.go +++ b/cmd/admin-heal.go @@ -159,6 +159,10 @@ func mainAdminHeal(ctx *cli.Context) error { errorIf(probe.NewError(obj.Err), "Cannot list objects to be healed.") continue } + // Heal object info is nil skip it, must be a directory. + if obj.HealObjectInfo == nil { + continue + } // Check the heal status, and call heal object API only when an object can be healed switch healInfo := *obj.HealObjectInfo; healInfo.Status {