uls.lcd: Add auto-correcting code when index goes beyond max index

Leave the error logging code in place in order to identify any
other places where this issue occurs.

Bug: https://phabricator.wikimedia.org/T328956
This commit is contained in:
Abijeet
2023-05-16 17:47:19 +05:30
committed by Niklas Laxström
parent 8fee21de8c
commit 8292fe90e3

View File

@@ -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();
},