Crash when category name/description is not specified.
Closed this issue ยท 1 comments
GSON serializes missing fields as null and these fields are not marked as nullable. This state should be handled somehow. There are a few potential solutions to this, I would personally default to a translation key if i18n is enabled, otherwise throw an error and prevent the loading of the category.
public ITextComponent getName() {
if (name == null && book.i18n) {
name = String.format("%s.%s.category.%s.name", book.id.namespace, book.id.path, this.id.path);
}
return book.i18n ? new TranslationTextComponent(name) : new StringTextComponent(name);
}
public String getDescription() {
if (description == null && book.i18n) {
description = String.format("%s.%s.category.%s.desc", book.id.namespace, book.id.path, this.id.path);
}
return description;
}