mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-04 14:38:49 +00:00
Fix NPE in message source
This commit is contained in:
1 parent
294fc8deb4
commit
ce99584306
1 file changed
+7
-1
@@ -196,7 +196,10 @@ public final class CarbonMessageSource implements IMessageSource<Audience, Strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String forAudience(final String key, final Audience audience) {
|
private String forAudience(final String key, final Audience audience) {
|
||||||
final String value = this.locales.get(this.defaultLocale).getProperty(key);
|
final Properties defaultProperties = this.locales.get(this.defaultLocale);
|
||||||
|
|
||||||
|
if (defaultProperties != null) {
|
||||||
|
final String value = defaultProperties.getProperty(key);
|
||||||
|
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
this.logger.warn("No message mapping for key " + key + " in default locale " + this.defaultLocale.getDisplayName());
|
this.logger.warn("No message mapping for key " + key + " in default locale " + this.defaultLocale.getDisplayName());
|
||||||
@@ -206,6 +209,9 @@ public final class CarbonMessageSource implements IMessageSource<Audience, Strin
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
private void walkPluginJar(final Consumer<Stream<Path>> user) throws IOException {
|
private void walkPluginJar(final Consumer<Stream<Path>> user) throws IOException {
|
||||||
if (Files.isDirectory(this.pluginJar)) {
|
if (Files.isDirectory(this.pluginJar)) {
|
||||||
try (final var stream = Files.walk(this.pluginJar)) {
|
try (final var stream = Files.walk(this.pluginJar)) {
|
||||||
|
|||||||
Reference in new issue
Block a user