diff --git a/src/core/lv_obj_tree.c b/src/core/lv_obj_tree.c index 5d72d76dc..d186ad0d3 100644 --- a/src/core/lv_obj_tree.c +++ b/src/core/lv_obj_tree.c @@ -339,7 +339,7 @@ uint32_t lv_obj_get_index(const lv_obj_t * obj) LV_ASSERT_OBJ(obj, MY_CLASS); lv_obj_t * parent = lv_obj_get_parent(obj); - if(parent == NULL) return 0; + if(parent == NULL) return 0xFFFFFFFF; uint32_t i = 0; for(i = 0; i < lv_obj_get_child_cnt(parent); i++) { diff --git a/src/core/lv_obj_tree.h b/src/core/lv_obj_tree.h index 4d10c550f..cc4ad3398 100644 --- a/src/core/lv_obj_tree.h +++ b/src/core/lv_obj_tree.h @@ -151,7 +151,8 @@ uint32_t lv_obj_get_child_cnt(const struct _lv_obj_t * obj); * Get the index of a child. * @param obj pointer to an object * @return the child index of the object. - * E.g. 0: the oldest (firstly created child) + * E.g. 0: the oldest (firstly created child). + * (0xFFFFFFFF if child could not be found or no parent exists) */ uint32_t lv_obj_get_index(const struct _lv_obj_t * obj);