KEYCLOAK-7608 Check if themes dir is null in FolderThemeProvider
This commit is contained in:
parent
812e76c39b
commit
c56e171f3a
2 changed files with 10 additions and 1 deletions
|
@ -42,12 +42,20 @@ public class FolderThemeProvider implements ThemeProvider {
|
|||
|
||||
@Override
|
||||
public Theme getTheme(String name, Theme.Type type) throws IOException {
|
||||
if (themesDir == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
File themeDir = getThemeDir(name, type);
|
||||
return themeDir.isDirectory() ? new FolderTheme(themeDir, name, type) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> nameSet(Theme.Type type) {
|
||||
if (themesDir == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
final String typeName = type.name().toLowerCase();
|
||||
File[] themeDirs = themesDir.listFiles(new FileFilter() {
|
||||
@Override
|
||||
|
@ -68,7 +76,7 @@ public class FolderThemeProvider implements ThemeProvider {
|
|||
|
||||
@Override
|
||||
public boolean hasTheme(String name, Theme.Type type) {
|
||||
return getThemeDir(name, type).isDirectory();
|
||||
return themesDir != null ? getThemeDir(name, type).isDirectory() : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -59,4 +59,5 @@ public class FolderThemeProviderFactory implements ThemeProviderFactory {
|
|||
public String getId() {
|
||||
return "folder";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue