Dodge NPE in ItemStackAdapter

This commit is contained in:
Olof Larsson 2015-01-14 23:26:32 +01:00
parent b2bdd68069
commit 1c42916d5b

View File

@ -441,7 +441,15 @@ public class ItemStackAdapter implements JsonDeserializer<ItemStack>, JsonSerial
if (meta2json)
{
if (!meta.hasTitle()) return;
json.add(BOOK_PAGES, convertStringList(meta.getPages()));
try
{
json.add(BOOK_PAGES, convertStringList(meta.getPages()));
}
catch (Exception e)
{
e.printStackTrace();
// It seems CraftMetaBook#getPages some times throw an NPE.
}
}
else
{