kourendlibrary: don't throw npe when starting on the login screen
books was null until you login, making the plugin throw every time the client starts
This commit is contained in:
@@ -351,11 +351,10 @@ public class KourendLibraryPlugin extends Plugin
|
|||||||
private void updatePlayerBooks()
|
private void updatePlayerBooks()
|
||||||
{
|
{
|
||||||
ItemContainer itemContainer = client.getItemContainer(InventoryID.INVENTORY);
|
ItemContainer itemContainer = client.getItemContainer(InventoryID.INVENTORY);
|
||||||
|
EnumSet<Book> books = EnumSet.noneOf(Book.class);
|
||||||
|
|
||||||
if (itemContainer != null)
|
if (itemContainer != null)
|
||||||
{
|
{
|
||||||
EnumSet<Book> books = EnumSet.noneOf(Book.class);
|
|
||||||
|
|
||||||
for (Item item : itemContainer.getItems())
|
for (Item item : itemContainer.getItems())
|
||||||
{
|
{
|
||||||
Book book = Book.byId(item.getId());
|
Book book = Book.byId(item.getId());
|
||||||
@@ -365,9 +364,9 @@ public class KourendLibraryPlugin extends Plugin
|
|||||||
books.add(book);
|
books.add(book);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
playerBooks = books;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
playerBooks = books;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBooksPanel()
|
private void updateBooksPanel()
|
||||||
|
|||||||
Reference in New Issue
Block a user