aboutsummaryrefslogtreecommitdiff
path: root/src/internal
diff options
context:
space:
mode:
authorAmol Yadav <amolyadav6125@gmail.com>2026-01-28 01:14:53 +0000
committerGopher Robot <gobot@golang.org>2026-01-28 08:44:36 -0800
commit6aef900af4eeb4a35d3ff1237a41cf3f63c56c24 (patch)
tree9c22f0f5f3cda8642a709efc359bac46ab3e4785 /src/internal
parent026fa9dc597ea8e5280d7531ce7f193ed157cad0 (diff)
downloadgo-6aef900af4eeb4a35d3ff1237a41cf3f63c56c24.tar.xz
runtime/metrics: fix panic in Read with empty slice
Calling Read with a nil or empty slice previously caused a panic with "index out of range" because the function unconditionally accessed the first element of the slice (via &m[0]) to pass the pointer to the runtime. This change adds a check for len(m) == 0 to return early, preventing the panic when no samples are provided. Fixes #77231 Change-Id: I442635f5c61de432883c8d0efae9cc6aa1363cc9 GitHub-Last-Rev: 6f24f67b18c77a0b36b92017a3f4ef8aa3aa5229 GitHub-Pull-Request: golang/go#77233 Reviewed-on: https://go-review.googlesource.com/c/go/+/737380 Reviewed-by: Amol Yadav <amolyadav6125@gmail.com> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Pratt <mpratt@google.com> Commit-Queue: Michael Pratt <mpratt@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'src/internal')
0 files changed, 0 insertions, 0 deletions