[libhandy] carousel-box: Null-check child in get_page_at_position()
- From: Guido Günther <guidog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy] carousel-box: Null-check child in get_page_at_position()
- Date: Wed, 21 Oct 2020 13:39:45 +0000 (UTC)
commit ddfd9b75e9db1fae9166debb13dc188f68d0f90e
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Thu Oct 8 12:18:35 2020 +0500
carousel-box: Null-check child in get_page_at_position()
It can be null when there are no children in the carousel.
src/hdy-carousel-box.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/hdy-carousel-box.c b/src/hdy-carousel-box.c
index 1e0355fb..cf6e6eb0 100644
--- a/src/hdy-carousel-box.c
+++ b/src/hdy-carousel-box.c
@@ -1723,7 +1723,7 @@ hdy_carousel_box_get_closest_snap_point (HdyCarouselBox *self)
* the current position, the returned widget will match the currently
* displayed page.
*
- * Returns: the closest page.
+ * Returns: (nullable): the closest page.
*
* Since: 1.0
*/
@@ -1742,6 +1742,9 @@ hdy_carousel_box_get_page_at_position (HdyCarouselBox *self,
child = get_closest_child_at (self, position, TRUE, FALSE);
+ if (!child)
+ return NULL;
+
return child->widget;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]