diff --git a/src/libsysprof-analyze/sysprof-time-series.c b/src/libsysprof-analyze/sysprof-time-series.c index 1f24233a..9ecb5fad 100644 --- a/src/libsysprof-analyze/sysprof-time-series.c +++ b/src/libsysprof-analyze/sysprof-time-series.c @@ -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 diff --git a/src/libsysprof-analyze/sysprof-xy-series.c b/src/libsysprof-analyze/sysprof-xy-series.c index e6eb5a42..7399bc4c 100644 --- a/src/libsysprof-analyze/sysprof-xy-series.c +++ b/src/libsysprof-analyze/sysprof-xy-series.c @@ -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