From edd7216016b62d6c1ca61625af759f15cd680b03 Mon Sep 17 00:00:00 2001 From: Joshua Lee Date: Tue, 20 Jul 2021 01:41:56 +0100 Subject: [PATCH] carousel: Fix crash when attempting to scroll on an empty carousel If there are no pages in a carousel, abandon the attempt at scrolling through it. Fixes #231 --- src/adw-carousel.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/adw-carousel.c b/src/adw-carousel.c index 3cddcfd9f..cf66b82b9 100644 --- a/src/adw-carousel.c +++ b/src/adw-carousel.c @@ -492,6 +492,9 @@ scroll_cb (AdwCarousel *self, if (!adw_carousel_get_interactive (self)) return GDK_EVENT_PROPAGATE; + if (adw_carousel_get_n_pages (self) == 0) + return GDK_EVENT_PROPAGATE; + source_device = gtk_event_controller_get_current_event_device (GTK_EVENT_CONTROLLER (controller)); input_source = gdk_device_get_source (source_device); if (input_source == GDK_SOURCE_TOUCHPAD) -- GitLab