- // Only process if the stack size has changed
- if ( macroLayerIndexStackSize == LCD_layerStack_prevSize )
+ // Ignore if the stack size hasn't changed and the top of the stack is the same
+ if ( macroLayerIndexStackSize == LCD_layerStack_prevSize
+ && macroLayerIndexStack[macroLayerIndexStackSize - 1] == LCD_layerStack_prevTop )