loottracker: prevent null events

Also detect and log null events from the clue scroll reward interface
This commit is contained in:
Adam
2020-02-13 10:39:49 -05:00
parent 9d908110b8
commit e737d73257
2 changed files with 10 additions and 1 deletions

View File

@@ -54,6 +54,7 @@ import javax.inject.Inject;
import javax.swing.SwingUtilities;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
@@ -345,7 +346,7 @@ public class LootTrackerPlugin extends Plugin
}
}
void addLoot(String name, int combatLevel, LootRecordType type, Collection<ItemStack> items)
void addLoot(@NonNull String name, int combatLevel, LootRecordType type, Collection<ItemStack> items)
{
final LootTrackerItem[] entries = buildEntries(stack(items));
SwingUtilities.invokeLater(() -> panel.add(name, type, combatLevel, entries));
@@ -429,6 +430,12 @@ public class LootTrackerPlugin extends Plugin
// Clue Scrolls use same InventoryID as Barrows
event = eventType;
container = client.getItemContainer(InventoryID.BARROWS_REWARD);
if (event == null)
{
log.debug("Clue scroll reward interface with no event!");
return;
}
break;
case (WidgetID.KINGDOM_GROUP_ID):
event = "Kingdom of Miscellania";

View File

@@ -24,12 +24,14 @@
*/
package net.runelite.client.plugins.loottracker;
import lombok.NonNull;
import lombok.Value;
import net.runelite.http.api.loottracker.LootRecordType;
@Value
class LootTrackerRecord
{
@NonNull
private final String title;
private final String subTitle;
private final LootRecordType type;