From 2b220ad0cbd624cfe0df0813dbdd672a21171241 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Mon, 12 Dec 2022 14:03:04 +0000 Subject: [PATCH] [v9.3.x] Prometheus: Fix exception being thrown when toggling visibility in explore (#60162) Prometheus: Fix exception being thrown when toggling visibility in explore (#60159) fix error being thrown when frameIndex is out of bounds of dataframe (cherry picked from commit b0f8e803a1661cdee902ae238bc748ec347e864e) Co-authored-by: Galen Kistler <109082771+gtk-grafana@users.noreply.github.com> --- .../app/plugins/panel/timeseries/plugins/ExemplarsPlugin.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/panel/timeseries/plugins/ExemplarsPlugin.tsx b/public/app/plugins/panel/timeseries/plugins/ExemplarsPlugin.tsx index 8f15fae1e88..7539afc8671 100644 --- a/public/app/plugins/panel/timeseries/plugins/ExemplarsPlugin.tsx +++ b/public/app/plugins/panel/timeseries/plugins/ExemplarsPlugin.tsx @@ -119,8 +119,8 @@ export const getVisibleLabels = (config: UPlotConfigBuilder, frames: DataFrame[] const fieldIndex = plotInstance.props?.dataFrameFieldIndex?.fieldIndex; if (frameIndex !== undefined && fieldIndex !== undefined) { - const field = frames[frameIndex].fields[fieldIndex]; - if (field.labels) { + const field = frames[frameIndex]?.fields[fieldIndex]; + if (field?.labels) { // Note that this may be an empty object in the case of a metric being rendered with no labels visibleLabels.push({ labels: field.labels,