[libadwaita] carousel: Fix crash when attempting to scroll on an empty carousel
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita] carousel: Fix crash when attempting to scroll on an empty carousel
- Date: Tue, 20 Jul 2021 06:54:13 +0000 (UTC)
commit edd7216016b62d6c1ca61625af759f15cd680b03
Author: Joshua Lee <lee son wai gmail com>
Date: Tue Jul 20 01:41:56 2021 +0100
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 3cddcfd9..cf66b82b 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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]