Skip to content

Commit 743fc96

Browse files
authored
Merge pull request #601 from alltilla/fix-metrics-labels-crash
filterx: fix `metrics_labels` crash
2 parents 0443ae7 + 861807a commit 743fc96

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/filterx/object-metrics-labels.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ _get_subscript(FilterXDict *s, FilterXObject *key)
8585
if (!filterx_object_extract_string_ref(key, &key_str, NULL))
8686
return NULL;
8787

88+
if (!self->labels->len)
89+
return NULL;
90+
8891
for (guint i = self->labels->len - 1; i >= 0; i--)
8992
{
9093
StatsClusterLabel *label = &g_array_index(self->labels, StatsClusterLabel, i);

news/fx-bugfix-601.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
`metrics_labels`: Fixed a crash that occurred when trying to get a label from an empty object.

0 commit comments

Comments
 (0)