Jump to content

A bug in lua scripts, which will cause game to crash. 一个会导致游戏崩溃的bug


driftee
  • Pending

file path:

scripts\components\inventory.lua:574

function Inventory:IsInsulated() -- from electricity, not temperature
    for k,v in pairs(self.equipslots) do
        if v and v.components.equippable:IsInsulated() then
            return true
        end
    end

    return self.isexternallyinsulated:Get()
end

Here `self.isexternallyinsulated` may somehow be set to nil by some mods or in some conditions. And when interpreted, this will cause game to crash. So I suggest a small modification:

function Inventory:IsInsulated() -- from electricity, not temperature
    for k,v in pairs(self.equipslots) do
        if v and v.components.equippable:IsInsulated() then
            return true
        end
    end


    if self.isexternallyinsulated ~= nil then
        return self.isexternallyinsulated:Get()
    end

    return false
end

某次用传送法杖传火药猴(很难复现)、打棱镜mod的boss莱克阿米特的时候都是这里报错


Steps to Reproduce

I can give my save if it is needed.




User Feedback




Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...