From: Jean-Philippe Bruyère Date: Thu, 25 Oct 2018 12:32:20 +0000 (+0200) Subject: prevent relative context drawing func to sigsev X-Git-Tag: v0.1-alpha~107^2~5 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=b930c01ea942619ee76b1289cf1ef9b37d5f1446;p=jp%2Fvkvg.git prevent relative context drawing func to sigsev --- 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); }