fix svg crash when image file is invalid

This commit is contained in:
lixianjing 2019-10-23 15:42:40 +08:00
parent aaa1ad796a
commit 5e3f50dc0b
2 changed files with 3 additions and 1 deletions

View File

@ -5,6 +5,7 @@
* 增加widget\_on\_with\_tag和widget\_off\_by\_tag方便一次注销多个同类事件。
* 完善list view对wheel事件的处理。
* 完善text selector处理up/down按键和wheel事件。
* 修改SVG无效图片崩溃的BUG。
* 2019/10/19
* 完善主题切换功能。

View File

@ -66,7 +66,8 @@ static ret_t svg_image_on_paint_self(widget_t* widget, canvas_t* c) {
const asset_info_t* asset = svg_image->bsvg_asset;
color_t bg = style_get_color(style, STYLE_ID_BG_COLOR, black);
color_t fg = style_get_color(style, STYLE_ID_FG_COLOR, black);
return_value_if_fail(asset != NULL && asset->data != NULL, RET_FAIL);
return_value_if_fail(bsvg_init(&bsvg, (const uint32_t*)asset->data, asset->size) != NULL,
RET_BAD_PARAMS);