Fix crash if buyer out of funds

This commit is contained in:
bri cassa 2022-07-10 18:42:25 +02:00
parent 15bba05412
commit 969571f559
1 changed files with 9 additions and 7 deletions

View File

@ -1088,14 +1088,16 @@ function ex_methods.sell(self, p_name, ex_name, item_name, wear, amount, rate)
sql_error(db:errmsg()) sql_error(db:errmsg())
end end
local in_succ, in_err = if not out_of_funds then
self:put_in_inbox(poster, item_name, wear, row_sold) local in_succ, in_err =
if not in_succ then self:put_in_inbox(poster, item_name, wear, row_sold)
search_stmt:reset() if not in_succ then
db:exec("ROLLBACK;") search_stmt:reset()
return false, in_err db:exec("ROLLBACK;")
return false, in_err
end
end end
if poster ~= p_name then if poster ~= p_name then
local revenue = row_sold * row_rate local revenue = row_sold * row_rate