From b930c01ea942619ee76b1289cf1ef9b37d5f1446 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Thu, 25 Oct 2018 14:32:20 +0200 Subject: [PATCH] prevent relative context drawing func to sigsev --- src/vkvg_context.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/vkvg_context.c b/src/vkvg_context.c index 75b0ab9..fed0bb2 100644 --- a/src/vkvg_context.c +++ b/src/vkvg_context.c @@ -211,6 +211,8 @@ void vkvg_close_path (VkvgContext ctx){ _finish_path(ctx); } void vkvg_rel_line_to (VkvgContext ctx, float x, float y){ + if (_current_path_is_empty(ctx)) + return; vec2 cp = _get_current_position(ctx); vkvg_line_to(ctx, cp.x + x, cp.y + y); } @@ -294,6 +296,8 @@ void vkvg_arc_negative (VkvgContext ctx, float xc, float yc, float radius, float } void vkvg_rel_move_to (VkvgContext ctx, float x, float y) { + if (_current_path_is_empty(ctx)) + return; vec2 cp = _get_current_position(ctx); vkvg_move_to(ctx, cp.x + x, cp.y + y); } @@ -314,6 +318,8 @@ void vkvg_curve_to (VkvgContext ctx, float x1, float y1, float x2, float y2, flo _add_point(ctx,x3,y3); } void vkvg_rel_curve_to (VkvgContext ctx, float x1, float y1, float x2, float y2, float x3, float y3) { + if (_current_path_is_empty(ctx)) + return; vec2 cp = _get_current_position(ctx); vkvg_curve_to (ctx, cp.x + x1, cp.y + y1, cp.x + x2, cp.y + y2, cp.x + x3, cp.y + y3); } -- 2.47.3