From b4bc1622d6a2075f860acba71477cf81c03b903c Mon Sep 17 00:00:00 2001 From: Andres Taylor Date: Mon, 16 Sep 2024 09:07:42 +0200 Subject: [PATCH] handle empty results Signed-off-by: Andres Taylor --- go/vt/vtgate/vcursor_impl.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 } }