bank: Fix NPE in PostScriptFired subscriber (#12342)
The bank widget can become null before the bank build script finishes by holding the bank close key as the bank is opened. This commit adds a null check to avoid this possible NPE.
This commit is contained in:
@@ -232,6 +232,8 @@ public class BankPlugin extends Plugin
|
||||
final Widget[] children = bankItemContainer.getChildren();
|
||||
long geTotal = 0, haTotal = 0;
|
||||
|
||||
if (children != null)
|
||||
{
|
||||
log.debug("Computing bank price of {} items", bankContainer.size());
|
||||
|
||||
// The first components are the bank items, followed by tabs etc. There are always 816 components regardless
|
||||
@@ -250,6 +252,7 @@ public class BankPlugin extends Plugin
|
||||
Widget bankTitle = client.getWidget(WidgetInfo.BANK_TITLE_BAR);
|
||||
bankTitle.setText(bankTitle.getText() + createValueText(geTotal, haTotal));
|
||||
}
|
||||
}
|
||||
else if (event.getScriptId() == ScriptID.BANKMAIN_SEARCH_REFRESH)
|
||||
{
|
||||
// vanilla only lays out the bank every 40 client ticks, so if the search input has changed,
|
||||
|
||||
Reference in New Issue
Block a user