From 2c3bacd1ed7f68e407766d96fa3da72b08674d21 Mon Sep 17 00:00:00 2001 From: "bozo.kopic" Date: Fri, 24 Dec 2021 02:12:55 +0100 Subject: WIP c implementation --- src_c/common.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src_c/common.c') diff --git a/src_c/common.c b/src_c/common.c index 5aca7a8..271c2f9 100644 --- a/src_c/common.c +++ b/src_c/common.c @@ -277,6 +277,10 @@ static int read_panel(char *json, opcut_panel_t *panel, jsmntok_t *tokens, } } + if (panel->width <= 0 || panel->height <= 0) + return OPCUT_ERROR; + panel->area = panel->width * panel->height; + return OPCUT_SUCCESS; } @@ -315,6 +319,10 @@ static int read_item(char *json, opcut_item_t *item, jsmntok_t *tokens, } } + if (item->width <= 0 || item->height <= 0) + return OPCUT_ERROR; + item->area = item->width * item->height; + return OPCUT_SUCCESS; } -- cgit v1.2.3-70-g09d2