diff --git a/src/jquery.uls.lcd.js b/src/jquery.uls.lcd.js index 39bf8f7..c5f5da4 100644 --- a/src/jquery.uls.lcd.js +++ b/src/jquery.uls.lcd.js @@ -112,8 +112,15 @@ if ( this.navigationIndex === null ) { this.navigationIndex = 0; } else { - this.navigationIndex++; + // Auto-correct the index. It has been noticed that the navigationIndex goes beyond the + // max index sometimes. See: phab:T328956#8854835 + if ( this.navigationIndex > maxIndex ) { + this.navigationIndex = maxIndex; + } else { + this.navigationIndex++; + } } + this.highlightLanguageOption(); },