Electroblob's Wizardry

Electroblob's Wizardry

18M Downloads

Missing null check in LivingDropsEvent for imbuements

Nuttar2004 opened this issue ยท 2 comments

commented

The game crashes. I don't know why my corpse mod will disappear when I create / kill mode, and the game will crash when my survival mode is killed by mob

This has happened many times and I don't know why. Only the crash report says electroblob.wizardry It feels like it did it. Can you help me out

I really like this mod and add it to the integration package I've been working on recently, let alone delete it. Please solve this problem quickly

Here is the crash report
crash-2020-06-14_21.54.22-server.txt
latest.log

These are for tonight. It's just one of them. I have a lot more

If I can, I can send more to you. I hope I can help you, and I

commented

EBWizardry should probably guard against null here,

public static void onLivingDropsEvent(LivingDropsEvent event){
// Instantly disenchants an imbued weapon if it is dropped when the player dies.
for(EntityItem item : event.getDrops()){
removeImbuements(item.getItem());
}
}

but also probably shouldn't have to. Corpse may be nulling the drops, rather than appropriately setting them to empty. It's hard to say, since the source code doesn't appear to be publicly visible. You may wish to file an issue with them as well.

commented

I had a feeling I'd seen this before, and sure enough I've put a comment to that effect in the other place I use LivingDropsEvent:

@SubscribeEvent
static void onLivingDropsEvent(LivingDropsEvent event){
// Destroys conjured items if their caster dies.
for(EntityItem item : event.getDrops()){
// Apparently some mods don't behave and shove null items in the list, quite why I have no idea
if(item != null && item.getItem() != null && item.getItem().getItem() instanceof IConjuredItem){
item.setDead();
}
}
}

It's simple enough to guard against nulls here too so I'll add that in. As @Tora-B points out though, I shouldn't have to do that so it may also be worth filing an issue with Corpse.