Hallowed Nights PigKing crash with modded characters


CarlZalph
  • Fixed

Error lies in scripts/skinsutils.lua:342

    for _,item_tag in pairs(tags) do
        if item_tag == tag then
            return true
        end
    end

Should be:

    if tags == nil then
        return false
    end
    for _,item_tag in pairs(tags) do
        if item_tag == tag then
            return true
        end
    end

For a fallback if no tags are found.

Alternatively it could be:

    for _,item_tag in pairs(tags or {}) do
        if item_tag == tag then
            return true
        end
    end

It gets overridden at the line "tags = Prefabs[item].skin_tags".

 

Alternatively alternatively it could also be changed via:

        if Prefabs[item] ~= nil then
            tags = Prefabs[item].skin_tags
        end

To:

        if Prefabs[item] ~= nil and Prefabs[item].skin_tags then
            tags = Prefabs[item].skin_tags
        end

 

Stack trace:

Spoiler

[01:44:22]: [string "scripts/skinsutils.lua"]:342: bad argument #1 to 'pairs' (table expected, got nil)
LUA ERROR stack traceback:
=[C]:-1 in (global) pairs (C) <-1--1>
scripts/skinsutils.lua:342 in (global) DoesItemHaveTag (Lua) <328-349>
   item = pluto_none
   tag = COSTUME
   tags = nil
scripts/prefabs/pigking.lua:63 in (field) fn (Lua) <22-76>
   inst = 109304 - pigking (valid:true)
   item = 114639 - trinket_39 (valid:false)
   giver = 133461 - pluto (valid:true)
   x = 511.5
   y = 4.5
   z = -251.5
   angle = 98.159663690086
   candytypes = table: 264C3CA0
   numcandies = 8
   _ = base
   item = pluto_none
scripts/scheduler.lua:177 in (method) OnTick (Lua) <155-207>
   self =
      running = table: 071ABCC8
      waitingfortick = table: 071AB9D0
      tasks = table: 071ABC78
      waking = table: 1D733B20
      attime = table: 071ABB60
      hibernating = table: 071ABC00
   tick = 180737
   k = PERIODIC 109304: 0.666667
   v = true
   already_dead = false
scripts/scheduler.lua:371 in (global) RunScheduler (Lua) <369-377>
   tick = 180737
scripts/update.lua:170 in () ? (Lua) <149-228>
   dt = 0.033333335071802
   tick = 180737
   i = 180737

[01:44:22]: [string "scripts/skinsutils.lua"]:342: bad argument #1 to 'pairs' (table expected, got nil)
LUA ERROR stack traceback:
    =[C]:-1 in (global) pairs (C) <-1--1>
    scripts/skinsutils.lua:342 in (global) DoesItemHaveTag (Lua) <328-349>
    scripts/prefabs/pigking.lua:63 in (field) fn (Lua) <22-76>
    scripts/scheduler.lua:177 in (method) OnTick (Lua) <155-207>
    scripts/scheduler.lua:371 in (global) RunScheduler (Lua) <369-377>
    scripts/update.lua:170 in () ? (Lua) <149-228>
	
[01:44:22]: Warning: Widget:SetFocusFromChild is happening on a widget outside of the screen/widget hierachy. This will cause focus moves to fail. Is 	ScriptErrorWidget	not a screen?	
[01:44:22]: stack traceback:
	scripts/widgets/widget.lua:602 in (method) SetFocusFromChild (Lua) <599-624>
	scripts/widgets/widget.lua:621 in (method) SetFocusFromChild (Lua) <599-624>
	scripts/widgets/widget.lua:621 in (method) SetFocusFromChild (Lua) <599-624>
	scripts/widgets/widget.lua:649 in (method) SetFocus (Lua) <626-658>
	scripts/widgets/menu.lua:83 in (method) SetFocus (Lua) <74-85>
	scripts/widgets/scripterrorwidget.lua:109 in (method) OnUpdate (Lua) <102-119>
	scripts/update.lua:90 in () ? (Lua) <33-129>	

 

 


Steps to Reproduce
Play as a modded character without skins and turn in a trinket to the pig king.

Status: Fixed

This issue has been fixed in either a future version or updated in a previous version.


  • Like 1
  Report Bug


User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.
....

Was just about to report on this. For a second I thought I had made a mistake on my end, but it turns out that this happens with all modded characters.

Share this comment


Link to comment
Share on other sites
.... .... ....

I just looked at this out of curiosity and they did it in an alternatively alternative alt way:

	if tags ~= nil then
		for _,item_tag in pairs(tags) do
			if item_tag == tag then
				return true
			end
		end
	end

The code pyramid rises a step!

Share this comment


Link to comment
Share on other sites


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