diff --git a/src/libsysprof-gtk/sysprof-line-layer.c b/src/libsysprof-gtk/sysprof-line-layer.c index 37c5e81e..b558ad35 100644 --- a/src/libsysprof-gtk/sysprof-line-layer.c +++ b/src/libsysprof-gtk/sysprof-line-layer.c @@ -115,6 +115,12 @@ sysprof_line_layer_snapshot (GtkWidget *widget, float x = floor (x_values[i] * width); float y = floor (y_values[i] * height); + /* Skip if we are getting data incorrectly on the X axis. + * It should have been sorted by this point. + */ + if (x < last_x) + continue; + cairo_curve_to (cr, last_x + ((x - last_x)/2), last_y, @@ -134,6 +140,12 @@ sysprof_line_layer_snapshot (GtkWidget *widget, float x = floor (x_values[i] * width); float y = floor (y_values[i] * height); + /* Skip if we are getting data incorrectly on the X axis. + * It should have been sorted by this point. + */ + if (x < last_x) + continue; + cairo_line_to (cr, x, y); last_x = x;