rezecib / Global-Positions

A mod for Don't Starve Together that adds various ways to find your friends (or spot your enemies).
17 stars 4 forks source link

Crash when Cawnival Crow Kid adds fuel to fire #7

Closed rezecib closed 2 years ago

rezecib commented 2 years ago

User Kova on steam posted:

Crashed: http://3.72.240.91/crashlogs/2022_06_03__01_36_15.txt

From the logs it's pretty clear that when Crow Kids add fuel to fire, they pass in nil, as seen in the ADDFUEL action:

ACTIONS.ADDFUEL.fn = function(act)
    if act.doer.components.inventory and act.invobject then
        local fuel = act.doer.components.inventory:RemoveItem(act.invobject)
        if fuel then
            if act.target.components.fueled and act.target.components.fueled:TakeFuelItem(fuel, act.doer) then
                return true
            else
                --print("False")
                act.doer.components.inventory:GiveItem(fuel)
            end
        end
    elseif act.doer.components.fueler then
        if act.target.components.fueled and act.target.components.fueled:TakeFuelItem(nil, act.doer) then
            return true
        end
    end
end

In my code here, we check if the fuel is charcoal, but we don't have a nil/table check for the item itself, because previously it was assumed there would always be an item.

I should add a simple check to see if it's a table before checking for charcoal.