From 4dc10b0753ed37be6dd3f539ee4a4fafe78480a3 Mon Sep 17 00:00:00 2001 From: vurtun Date: Fri, 6 May 2016 10:52:59 +0200 Subject: [PATCH] Fixed mixed chart test case in `overview.c` Forgot to add a condition to check if the chart even needs to be run at all so the chart will assert. --- demo/overview.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/demo/overview.c b/demo/overview.c index 52ad80d..e440c6d 100644 --- a/demo/overview.c +++ b/demo/overview.c @@ -607,14 +607,15 @@ overview(struct nk_context *ctx) /* mixed chart */ nk_layout_row_dynamic(ctx, 100, 1); bounds = nk_widget_bounds(ctx); - nk_chart_begin(ctx, NK_CHART_COLUMN, 32, 0.0f, 1.0f); - nk_chart_add_slot(ctx, NK_CHART_LINES, 32, -1.0f, 1.0f); - nk_chart_add_slot(ctx, NK_CHART_LINES, 32, -1.0f, 1.0f); - for (id = 0, i = 0; i < 32; ++i) { - nk_chart_push_slot(ctx, (float)fabs(sin(id)), 0); - nk_chart_push_slot(ctx, (float)cos(id), 1); - nk_chart_push_slot(ctx, (float)sin(id), 2); - id += step; + if (nk_chart_begin(ctx, NK_CHART_COLUMN, 32, 0.0f, 1.0f)) { + nk_chart_add_slot(ctx, NK_CHART_LINES, 32, -1.0f, 1.0f); + nk_chart_add_slot(ctx, NK_CHART_LINES, 32, -1.0f, 1.0f); + for (id = 0, i = 0; i < 32; ++i) { + nk_chart_push_slot(ctx, (float)fabs(sin(id)), 0); + nk_chart_push_slot(ctx, (float)cos(id), 1); + nk_chart_push_slot(ctx, (float)sin(id), 2); + id += step; + } } nk_chart_end(ctx); nk_tree_pop(ctx);