Dodge NPE in ItemStackAdapter
This commit is contained in:
parent
b2bdd68069
commit
1c42916d5b
@ -441,8 +441,16 @@ public class ItemStackAdapter implements JsonDeserializer<ItemStack>, JsonSerial
|
|||||||
if (meta2json)
|
if (meta2json)
|
||||||
{
|
{
|
||||||
if (!meta.hasTitle()) return;
|
if (!meta.hasTitle()) return;
|
||||||
|
try
|
||||||
|
{
|
||||||
json.add(BOOK_PAGES, convertStringList(meta.getPages()));
|
json.add(BOOK_PAGES, convertStringList(meta.getPages()));
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
// It seems CraftMetaBook#getPages some times throw an NPE.
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
JsonElement element = json.get(BOOK_PAGES);
|
JsonElement element = json.get(BOOK_PAGES);
|
||||||
|
Loading…
Reference in New Issue
Block a user