From 5075a218b5f493b6dcf49ec8be63e1ccf150ba08 Mon Sep 17 00:00:00 2001 From: Niko Date: Wed, 16 Feb 2022 21:28:44 +0100 Subject: [PATCH] Fix carousel not working when item is deleted or no items at all --- web/src/app/js/carousel.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/src/app/js/carousel.js b/web/src/app/js/carousel.js index 916351a..2304007 100644 --- a/web/src/app/js/carousel.js +++ b/web/src/app/js/carousel.js @@ -21,6 +21,11 @@ app.carousel = { const elements = mod._elements(); const current = elements[mod._current]; const next = elements[i]; + if (next === undefined) { + if (i > 0) + return app.carousel.set(mod, 0); + return false; + } var direction = 'none'; if (i > mod._current) direction = 'right';