From 66bc6eb6bf66d03400dabca0c333c069b1eaaf0f Mon Sep 17 00:00:00 2001 From: Andres Taylor Date: Fri, 20 Dec 2024 12:05:46 +0100 Subject: [PATCH] check that we have a result before using it Signed-off-by: Andres Taylor --- go/vt/vtgate/executorcontext/vcursor_impl.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/vt/vtgate/executorcontext/vcursor_impl.go b/go/vt/vtgate/executorcontext/vcursor_impl.go index 4414397f49d..40317f5103a 100644 --- a/go/vt/vtgate/executorcontext/vcursor_impl.go +++ b/go/vt/vtgate/executorcontext/vcursor_impl.go @@ -772,7 +772,7 @@ func (vc *VCursorImpl) ExecuteMultiShard(ctx context.Context, primitive engine.P qr, errs := vc.executor.ExecuteMultiShard(ctx, primitive, rss, commentedShardQueries(queries, vc.marginComments), vc.SafeSession, canAutocommit, vc.ignoreMaxMemoryRows, vc.observer, fetchLastInsertID) vc.setRollbackOnPartialExecIfRequired(len(errs) != len(rss), rollbackOnError) vc.logShardsQueried(primitive, len(rss)) - if qr.InsertIDUpdated() { + if qr != nil && qr.InsertIDUpdated() { vc.SafeSession.LastInsertId = qr.InsertID } return qr, errs