cmd: Fix dump of void slice

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
This commit is contained in:
Frédéric Danis
2019-02-17 10:38:24 +01:00
committed by Sjoerd Simons
parent 6c13b917b5
commit af3a65297b

View File

@@ -110,7 +110,7 @@ func DumpActionFields(iface interface{}, depth int) {
case reflect.Slice:
s := reflect.ValueOf(f.Interface())
if s.Index(0).Kind() == reflect.Struct {
if s.Len() > 0 && s.Index(0).Kind() == reflect.Struct {
log.Printf(" %s:\n", entries.Type().Field(i).Name)
for j := 0; j < s.Len(); j++ {
if s.Index(j).Kind() == reflect.Struct {