Fix issue: search strings like 't', 'a' are not giving results

There are languges starting with those letters, but without autonyms
Add a null check for undefined autonyms to prevent js error

Change-Id: I88a1d79b3bb23beac7238c1e8817cd6eac614613
This commit is contained in:
Santhosh Thottingal
2012-08-07 16:22:38 +05:30
parent 13403af261
commit a9e49acf79

View File

@@ -163,7 +163,7 @@
suggestion = userInput + languageName.substring( userInput.length, languageName.length );
if ( suggestion !== languageName ) {
// see if it was autonym match
autonym = $.uls.data.autonym( langCode );
autonym = $.uls.data.autonym( langCode ) || '';
suggestion = userInput + autonym.substring( userInput.length, autonym.length );
if ( suggestion !== autonym ) {
// Give up. It may be iso/script code match.