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