libsysprof-analyze: return NULL if series is empty

This commit is contained in:
Christian Hergert
2023-06-20 15:34:11 -07:00
parent faf2303015
commit 982eee7f31
2 changed files with 10 additions and 2 deletions

View File

@ -150,7 +150,11 @@ sysprof_time_series_get_values (const SysprofTimeSeries *self,
guint *n_values)
{
*n_values = self->values->len;
return &g_array_index (self->values, SysprofTimeSeriesValue, 0);
if (self->values->len > 0)
return &g_array_index (self->values, SysprofTimeSeriesValue, 0);
return NULL;
}
static int

View File

@ -169,7 +169,11 @@ sysprof_xy_series_get_values (const SysprofXYSeries *self,
guint *n_values)
{
*n_values = self->values->len;
return &g_array_index (self->values, SysprofXYSeriesValue, 0);
if (self->values->len > 0)
return &g_array_index (self->values, SysprofXYSeriesValue, 0);
return NULL;
}
static int