From b0f8e803a1661cdee902ae238bc748ec347e864e Mon Sep 17 00:00:00 2001 From: Galen Kistler <109082771+gtk-grafana@users.noreply.github.com> Date: Mon, 12 Dec 2022 07:44:15 -0600 Subject: [PATCH] Prometheus: Fix exception being thrown when toggling visibility in explore (#60159) fix error being thrown when frameIndex is out of bounds of dataframe --- .../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,