mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-30 07:06:19 +08:00
add lv_mem_assert to memory allocations
This commit is contained in:
@@ -67,11 +67,15 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Create the ancestor object*/
|
||||
lv_obj_t * new_btnm = lv_obj_create(par, copy);
|
||||
lv_mem_assert(new_btnm);
|
||||
if(new_btnm == NULL) return NULL;
|
||||
|
||||
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_func(new_btnm);
|
||||
|
||||
/*Allocate the object type specific extended data*/
|
||||
lv_btnm_ext_t * ext = lv_obj_allocate_ext_attr(new_btnm, sizeof(lv_btnm_ext_t));
|
||||
lv_mem_assert(ext);
|
||||
if(ext == NULL) return NULL;
|
||||
|
||||
ext->btn_cnt = 0;
|
||||
ext->btn_id_pr = LV_BTNM_PR_NONE;
|
||||
ext->btn_id_tgl = LV_BTNM_PR_NONE;
|
||||
@@ -693,6 +697,9 @@ static void create_buttons(lv_obj_t * btnm, const char ** map)
|
||||
}
|
||||
|
||||
ext->button_areas = lv_mem_alloc(sizeof(lv_area_t) * btn_cnt);
|
||||
lv_mem_assert(ext->button_areas);
|
||||
if(ext->button_areas == NULL) btn_cnt = 0;
|
||||
|
||||
ext->btn_cnt = btn_cnt;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user