KaylebJay / tunnelers-bugz

No code. Bug tracker for the Tunnelers' Abyss Minetest Server. Please report all bugs here or at our Discord in channel #dev.
4 stars 3 forks source link

Crash in inventorybugs #184

Closed KaylebJay closed 4 years ago

KaylebJay commented 4 years ago
2020-07-03 00:56:03: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'inventorybags' in callback node_on_dig(): ...t/bin/../mods/secretz/inventorybags/upgrades.lua:504: bad argument #1 to 'pairs' (table expected, got nil)
2020-07-03 00:56:03: ERROR[Main]: stack traceback:
2020-07-03 00:56:03: ERROR[Main]:   [C]: in function 'pairs'
2020-07-03 00:56:03: ERROR[Main]:   ...t/bin/../mods/secretz/inventorybags/upgrades.lua:504: in function 'make_max_crafting'
2020-07-03 00:56:03: ERROR[Main]:   ...t/bin/../mods/secretz/inventorybags/upgrades.lua:535: in function 'on_change_bag_inv'
2020-07-03 00:56:03: ERROR[Main]:   ...etest/bin/../mods/secretz/inventorybags/bags.lua:80: in function 'bag_inv_add_item'
2020-07-03 00:56:03: ERROR[Main]:   ...t/bin/../mods/secretz/inventorybags/upgrades.lua:319: in function 'func'
2020-07-03 00:56:03: ERROR[Main]:   ...ser/minetest/bin/../builtin/profiler/instrumentation.lua:106: in function 'callback'
2020-07-03 00:56:03: ERROR[Main]:   /home/vpsuser/minetest/bin/../builtin/game/item.lua:649: in function </home/vpsuser/minetest/bin/../builtin/game/item.lua:550>
fluxionary commented 4 years ago

I can't find anything wrong w/ my bag filters; it might be that it was because I hadn't opened the bag before upgrading and using it.

KaylebJay commented 4 years ago

That's horrible! Please try this in a local world and see if it crashes - perhaps we can create a fix from this.

fluxionary commented 4 years ago

Yeah, I plan on doing some further testing tomorrow (hopefully tomorrow) on a local server. Don't have the brain for it tonight.

fluxionary commented 4 years ago

I've figured out the issue. I had an invalid recipe (8 coal lumps + 1 mese crystal instead of 9 coal lumps), which resulted in a nil in the middle of the recipes table at that point (for whatever reason). A quick-fix is to change line 521 from

nrecipes = nrecipes -1

to

nrecipes = #recipes_table

There might be a better way to fix the problem, but this'll work for the time being.

KaylebJay commented 4 years ago

Need to test this fix. Thanks flux!

KaylebJay commented 4 years ago

Appears to work, pushing.