lv_obj_set_parent: test input paramters

This commit is contained in:
Gabor Kiss-Vamosi
2018-08-15 12:32:53 +02:00
parent ad79620983
commit e96bbdd31a
2 changed files with 15 additions and 4 deletions

View File

@@ -431,11 +431,22 @@ void lv_scr_load(lv_obj_t * scr)
/**
* Set a new parent for an object. Its relative position will be the same.
* @param obj pointer to an object
* @param parent pointer to the new parent object
* @param obj pointer to an object. Can't be a screen.
* @param parent pointer to the new parent object. (Can't be NULL)
*/
void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent)
{
if(obj->par == NULL) {
LV_LOG_WARN("Can't set the parent of a screen");
return;
}
if(parent == NULL) {
LV_LOG_WARN("Can't set parent == NULL to an object");
return;
}
lv_obj_invalidate(obj);
lv_point_t old_pos;