mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
Fixed NullPointerException case on 'Browser' lang selection
Occurred when English was the only active language, then making the ConfigBasic.html page unusable until manually modifying the locale.language setting.
This commit is contained in:
parent
ae1c675c85
commit
6b11bf3a12
|
@ -326,16 +326,23 @@ public class Translator {
|
|||
* @return list of language-codes of available/active translations
|
||||
*/
|
||||
public static List<String> activeTranslations() {
|
||||
Switchboard sb = Switchboard.getSwitchboard();
|
||||
File localePath;
|
||||
if (sb != null)
|
||||
final Switchboard sb = Switchboard.getSwitchboard();
|
||||
final File localePath;
|
||||
if (sb != null) {
|
||||
localePath = sb.getDataPath("locale.translated_html", "DATA/LOCALE/htroot");
|
||||
else
|
||||
} else {
|
||||
localePath = new File ("DATA/LOCALE/htroot");
|
||||
List<String> dirlist = new ArrayList<String>(); // get list of language subdirectories
|
||||
File[] list = localePath.listFiles();
|
||||
for (File f : list) {
|
||||
if (f.isDirectory()) dirlist.add(f.getName()); // filter directories to add to result
|
||||
}
|
||||
final List<String> dirlist = new ArrayList<String>(); // get list of language subdirectories
|
||||
if(localePath.isDirectory()) {
|
||||
final File[] list = localePath.listFiles();
|
||||
if(list != null) { // the list may be null on IO error
|
||||
for (final File f : list) {
|
||||
if (f.isDirectory()) {
|
||||
dirlist.add(f.getName()); // filter directories to add to result
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return dirlist;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user