From 36b461a99a41835a636becc7760c54b26cd7228a Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Sun, 19 Nov 2017 12:16:30 -0600 Subject: [PATCH] If using an old sketch, ignore LayerCount If it's an old sketch, LayerCount will default to 0, so in order for Layer.on() to function, don't bother checking for out-of-bounds if LayerCount == 0. --- src/layers.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/layers.cpp b/src/layers.cpp index 0cf9129d..125ca4a4 100644 --- a/src/layers.cpp +++ b/src/layers.cpp @@ -129,9 +129,8 @@ void Layer_::move(uint8_t layer) { void Layer_::on(uint8_t layer) { // If we're trying to turn on a layer that doesn't exist; abort - if (layer >= LayerCount) { + if (LayerCount != 0 && layer >= LayerCount) return; - } bool wasOn = isOn(layer);