Skip to content

Commit

Permalink
Add missing JS_ToBool() error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
TooTallNate committed Oct 7, 2023
1 parent e9f1d37 commit ee42c2a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions source/canvas.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ static JSValue js_canvas_arc(JSContext *ctx, JSValueConst this_val, int argc, JS
}

int counterclockwise = JS_ToBool(ctx, argv[6]);
if (counterclockwise == -1)
return JS_EXCEPTION;

cairo_t *cr = context->ctx;

Expand Down Expand Up @@ -472,6 +474,8 @@ static JSValue js_canvas_ellipse(JSContext *ctx, JSValueConst this_val, int argc
double startAngle = args[5];
double endAngle = args[6];
int anticlockwise = JS_ToBool(ctx, argv[8]);
if (anticlockwise == -1)
return JS_EXCEPTION;

cairo_t *cr = context->ctx;

Expand Down Expand Up @@ -1193,6 +1197,9 @@ static JSValue js_canvas_draw_image(JSContext *ctx, JSValueConst this_val, int a

cairo_surface_t *surface;
int is_canvas = JS_ToBool(ctx, argv[12]);
if (is_canvas == -1)
return JS_EXCEPTION;

if (is_canvas)
{
// Canvas
Expand Down

0 comments on commit ee42c2a

Please sign in to comment.