summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXor Boole <mcyoung@mit.edu>2014-12-28 13:57:27 -0400
committerXor Boole <mcyoung@mit.edu>2014-12-28 13:57:27 -0400
commite8e3ca29e250f38be86e7c97f0bf03cec5374693 (patch)
treef4159480176d7e57a37a4f4df53864a11fde19b4
parenteae50b4f2af2740d02c71a3d78bbc8a1dd8ebcd1 (diff)
downloadcraftbukkit-e8e3ca29e250f38be86e7c97f0bf03cec5374693.tar
craftbukkit-e8e3ca29e250f38be86e7c97f0bf03cec5374693.tar.gz
craftbukkit-e8e3ca29e250f38be86e7c97f0bf03cec5374693.tar.lz
craftbukkit-e8e3ca29e250f38be86e7c97f0bf03cec5374693.tar.xz
craftbukkit-e8e3ca29e250f38be86e7c97f0bf03cec5374693.zip
Add null check before iterating over iterator.
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
index a76ae7d7..42ecde7e 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
@@ -99,9 +99,11 @@ class CraftMetaBook extends CraftMetaItem implements BookMeta {
setTitle(SerializableMeta.getString(map, BOOK_TITLE.BUKKIT, true));
Iterable<?> pages = SerializableMeta.getObject(Iterable.class, map, BOOK_PAGES.BUKKIT, true);
- for (Object page : pages) {
- if (page instanceof String) {
- addPage((String) page);
+ if(pages != null) {
+ for (Object page : pages) {
+ if (page instanceof String) {
+ addPage((String) page);
+ }
}
}