mirror of
https://github.com/lvgl/lvgl.git
synced 2026-06-01 08:54:52 +08:00
fix(menu): fix crash on delete (#3154)
* fix(menu): fix crash on delete fixes #3123 * handle NULL * code formatting
This commit is contained in:
committed by
GitHub
parent
08a3cc0eb6
commit
a6c4c13490
@@ -124,7 +124,15 @@ lv_obj_t * lv_menu_page_create(lv_obj_t * parent, char * title)
|
||||
lv_obj_class_init_obj(obj);
|
||||
|
||||
lv_menu_page_t * page = (lv_menu_page_t *)obj;
|
||||
page->title = title;
|
||||
if(title) {
|
||||
page->title = lv_mem_alloc(strlen(title) + 1);
|
||||
LV_ASSERT_MALLOC(page->title);
|
||||
if(page->title == NULL) return NULL;
|
||||
strcpy(page->title, title);
|
||||
}
|
||||
else {
|
||||
page->title = NULL;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user