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:
Max Weber
2020-04-07 13:27:21 -06:00
parent 6abc433141
commit 81914b7c95

View File

@@ -351,11 +351,10 @@ public class KourendLibraryPlugin extends Plugin
private void updatePlayerBooks()
{
ItemContainer itemContainer = client.getItemContainer(InventoryID.INVENTORY);
EnumSet<Book> books = EnumSet.noneOf(Book.class);
if (itemContainer != null)
{
EnumSet<Book> books = EnumSet.noneOf(Book.class);
for (Item item : itemContainer.getItems())
{
Book book = Book.byId(item.getId());
@@ -365,9 +364,9 @@ public class KourendLibraryPlugin extends Plugin
books.add(book);
}
}
playerBooks = books;
}
playerBooks = books;
}
private void updateBooksPanel()