diff --git a/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java b/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java index 8ee32d985fb545d15fc144c64894599bbc4ee8ed..8068e746115c010f17b3132677036fce0ca64c75 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java +++ b/apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java @@ -600,10 +600,10 @@ public class SnarkManager implements CompleteListener { /** * Get all themes - * @return String[] -- Array of all the themes found. + * @return String[] -- Array of all the themes found, non-null, unsorted */ public String[] getThemes() { - String[] themes = null; + String[] themes; // "docs/themes/snark/" File dir = new File(_context.getBaseDir(), "docs/themes/snark"); FileFilter fileFilter = new FileFilter() { public boolean accept(File file) { return file.isDirectory(); } }; @@ -614,6 +614,8 @@ public class SnarkManager implements CompleteListener { for(int i = 0; i < dirnames.length; i++) { themes[i] = dirnames[i].getName(); } + } else { + themes = new String[0]; } // return the map. return themes; diff --git a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java index 076caced61b4c78face408e0a83e0b90342d4f0d..086fa4670e303a2e96f5be59ddfc33f69da27970 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java +++ b/apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java @@ -2115,6 +2115,7 @@ public class I2PSnarkServlet extends BasicServlet { out.write(": <td><select name='theme'>"); String theme = _manager.getTheme(); String[] themes = _manager.getThemes(); + Arrays.sort(themes); for(int i = 0; i < themes.length; i++) { if(themes[i].equals(theme)) out.write("\n<OPTION value=\"" + themes[i] + "\" SELECTED>" + themes[i]);