View Single Post
12/29/14, 06:56 PM   #6
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by merlight View Post
Why not check only slotData. The whole IsBagSlotOccupied check seems redundant (and also overly tolerant to invalid input if you ask me )
This is called in a function that is open to other addons for a library & I don't trust them to pass in a valid bag/slot....and at times GenerateSingleSlotData(..) was generating errors because the bagid & slotId were not valid.

I don't remember now, I think the problem was that they were nil. So I could have "just" checked to ensure they are not nil, but I wasn't sure if any other invalid values would also throw an error so I thought the best method would be to just check to make sure the bag/slot are ones that I know are valid, which worked.

But the slotData could still come out nil so had to check it too.

Redundant, I agree!! I dunno maybe your right it, is overly tolerant. Its their own fault if they pass in bad values to start with.
  Reply With Quote