copygirl's Wearable Backpacks

copygirl's Wearable Backpacks

15M Downloads

getIsRepairable doesn't handle getting empty stacks

DaedalusGame opened this issue ยท 6 comments

commented

you directly call getOreIDs which will throw an exception if the stack is empty
this isn't a big deal, and i can fix this problem on my end just wanted to check with you
other than that, backpacks also don't return a proper repair material stack (which is basicly how this got tangled in my code to begin with)

EDIT: I resolved this on my end but maybe this still deserves looking at, poorly implemented repair machines could crash badly, idk.

commented

I have mixed feelings about getIsRepeairable having to account for empty stacks. Like, why would you call it with an empty stack in the first case? Then, on the other hand, empty stacks are supposed to make things less painful and crashy.

I don't have a dev environment so I can't check and say anything about the repair material stack thing. WBs is shelved for me right now, so not sure if I'll get to work on this issue.

commented

Poorly implemented repair machines should become less poorly implemented. We shouldn't hide issues.

commented

i mean, fair enough, but would you expect that passing the repair item from the item into its isRepairable method crashes the game?

commented

If the repair item is an empty stack (or null?), you already know it's not repairable. Why would you call anything on top of that?

commented

Oh, we return an empty stack? We should probably kind of cover that, then.

commented

Oh, we return an empty stack? We should probably kind of cover that, then.

It's the default behavior for Item.