diff --git a/go/vt/vtgate/vcursor_impl.go b/go/vt/vtgate/vcursor_impl.go index 018228b6e7c..cfa0b382ae0 100644 --- a/go/vt/vtgate/vcursor_impl.go +++ b/go/vt/vtgate/vcursor_impl.go @@ -535,7 +535,11 @@ func (vc *vcursorImpl) logOpTraffic(primitive engine.Primitive, res *sqltypes.Re if vc.primitiveStats != nil { key := int(primitive.GetID()) rows := vc.primitiveStats[key] - rows = append(rows, len(res.Rows)) + if res == nil { + rows = append(rows, 0) + } else { + rows = append(rows, len(res.Rows)) + } vc.primitiveStats[key] = rows } }