From 9684949a1d8a82c642fc9c285ad8989d1ed32585 Mon Sep 17 00:00:00 2001 From: Edward Shen Date: Thu, 8 Aug 2019 12:58:21 -0400 Subject: [PATCH] Add null handling for negative null. Closes #22. --- MMM-pages.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MMM-pages.js b/MMM-pages.js index 13b3aef..a5b7dc0 100644 --- a/MMM-pages.js +++ b/MMM-pages.js @@ -41,7 +41,7 @@ Module.register('MMM-pages', { */ start: function() { this.curPage = 0; - + // Compatibility if (this.config.excludes.length) { Log.warn(`[Pages]: The config option "excludes" is deprecated. Please use "fixed" instead.`); @@ -79,7 +79,9 @@ Module.register('MMM-pages', { break; case 'PAGE_DECREMENT': Log.log('[Pages]: received a notification to decrement pages!'); - this.changePageBy(-payload, -1); + // We can't just pass in -payload for situations where payload is null + // JS will coerce -payload to -0. + this.changePageBy(payload ? -payload : payload, -1); this.updatePages(); break; case 'DOM_OBJECTS_CREATED':