Correct the loop logic for language buttons
It is possible that the count reach more than SUGGESTED_LANGUAGES_NUMBER before it reach the languagesForButtons.length === SUGGESTED_LANGUAGES_NUMBER check. This will cause the loop to run for all languages. Change-Id: Ie6190d1c80c2a7152af490db2bc115ecdfde4184
This commit is contained in:
committed by
Santhosh
parent
f16c42ef71
commit
c9aa1f1130
@@ -188,7 +188,7 @@
|
||||
languagesForButtons.push( suggestedLanguages[lang] );
|
||||
|
||||
// No need to add more languages than buttons
|
||||
if ( languagesForButtons.length === SUGGESTED_LANGUAGES_NUMBER ) {
|
||||
if ( languagesForButtons.length >= SUGGESTED_LANGUAGES_NUMBER ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@
|
||||
languagesForButtons.push( suggestedLanguages[lang] );
|
||||
|
||||
// No need to add more languages than buttons
|
||||
if ( languagesForButtons.length === SUGGESTED_LANGUAGES_NUMBER ) {
|
||||
if ( languagesForButtons.length >= SUGGESTED_LANGUAGES_NUMBER ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user