aboutsummaryrefslogtreecommitdiff
path: root/src_c/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src_c/common.c')
-rw-r--r--src_c/common.c8
1 files changed, 8 insertions, 0 deletions
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;
}