mt-mods / fancy_vend

A full-featured, fully-integrated vendor mod for Minetest.
MIT License
0 stars 1 forks source link

Server Crash when buying from overstacked stock. #4

Open mightyjoe781 opened 2 years ago

mightyjoe781 commented 2 years ago

Server Information : multicraft-2.0.0

Ways to replicate :

  1. Fill in the vendor with say 1000 wood blocks as single stack.
  2. set cost of 100 wood blocks as 1 minegeld
  3. Buying something like 100 wood blocks ( > 99 stack limit) will cause crash.

NOTE : when tried similar thing but instead of 1000 wood blocks as a single stack i separated stacks into sets of stack limit, fancy vendor works fine then.

NOTE : similar thing tested with smartshops mod works fine when tried with different scenarios.

2022-02-06 03:28:24: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback on_playerReceiveFields(): ...lds/delta/worldmods/fancy_vend/inventory_helpers.lua:73: attempt to index field '?' (a nil value)
2022-02-06 03:28:24: ERROR[Main]: stack traceback:
2022-02-06 03:28:24: ERROR[Main]:       ...lds/delta/worldmods/fancy_vend/inventory_helpers.lua:73: in function 'inv_insert'
2022-02-06 03:28:24: ERROR[Main]:       ...rismo/worlds/delta/worldmods/fancy_vend/purchase.lua:58: in function 'make_purchase'
2022-02-06 03:28:24: ERROR[Main]:       ...worlds/delta/worldmods/fancy_vend/receive_fields.lua:83: in function '?'
2022-02-06 03:28:24: ERROR[Main]:       ...e/prismo/multicraft/bin/../builtin/game/register.lua:441: in function <...e/prismo/multicraft/bin/../builtin/game/register.lua:425>
mightyjoe781 commented 2 years ago

One of the simple fix maybe is to stop the transaction if the vendor inventory contains over-stacked items than what server allows.