Jump to content

A projectile crash seems caused by wortox.


gznc
  • Fixed

[01:34:02]: [string "scripts/components/projectile.lua"]:169: attempt to index field 'owner' (a nil value)
LUA ERROR stack traceback:
scripts/components/projectile.lua:169 in (method) Miss (Lua) <167-177>
   self =
      dest = (-1927.99, 0.00, 1439.56)
      start = (-1905.26, 0.00, 1287.07)
      onthrown = function - scripts/prefabs/wortox_soul_spawn.lua:96
      onmiss = function - scripts/entityscript.lua:1339
      _ondelaycancel = function - scripts/components/projectile.lua:33
      inst = 137083 - wortox_soul_spawn  MISSING NAME (valid:true)
      onhit = function - scripts/prefabs/wortox_soul_spawn.lua:69
      speed = 10
      hitdist = 0.5
      homing = true
      _ = table: 1BEB64E0
   target = nil
   attacker = nil
scripts/prefabs/wortox_soul_spawn.lua:93 in (field) fn (Lua) <91-94>
   inst = 137083 - wortox_soul_spawn  MISSING NAME (valid:true)
scripts/scheduler.lua:177 in (method) OnTick (Lua) <155-207>
   self =
      running = table: 0922D388
      waitingfortick = table: 0922D158
      tasks = table: 0922D130
      waking = table: 1BFBFD40
      attime = table: 0922D1F8
      hibernating = table: 0922D180
   tick = 167928
   k = PERIODIC 137083: 6.000000
   v = true
   already_dead = false
scripts/scheduler.lua:371 in (global) RunScheduler (Lua) <369-377>
   tick = 167928
scripts/update.lua:170 in () ? (Lua) <149-228>
   dt = 0.033333335071802
   tick = 167928
   i = 167928

[01:34:02]: [string "scripts/components/projectile.lua"]:169: attempt to index field 'owner' (a nil value)
LUA ERROR stack traceback:
    scripts/components/projectile.lua:169 in (method) Miss (Lua) <167-177>
    scripts/prefabs/wortox_soul_spawn.lua:93 in (field) fn (Lua) <91-94>
    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>


Steps to Reproduce
unknown...



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.

I have found a repeat case for this bug:

1) Kill a spider to spawn a soul.

2) Teleport away before the soul is collected but after it starts following you- timing required.

3) Repeatedly teleport away until the following soul is 64*1.2 units away and goes into limbo.

4) Wait the remaining 6 seconds before the 'miss' timer calls.

5) Server crash because the owner isn't valid anymore (soul is in limbo or spawner is in limbo/deleted).

 

This can be fixed by editing~

scripts/components/projectile.lua:167::

function Projectile:Miss(target)
    local attacker = self.owner
    if self.owner.components.combat == nil and self.owner.components.weapon ~= nil and self.owner.components.inventoryitem ~= nil then
        attacker = self.owner.components.inventoryitem.owner
    end

To be:

function Projectile:Miss(target)
    local attacker = self.owner
    if attacker ~= nil and attacker.components.combat == nil and attacker.components.weapon ~= nil and attacker.components.inventoryitem ~= nil then
        attacker = attacker.components.inventoryitem.owner
    end

 

All of the other base code makes the assumption that the attacker field can be nil so passing nil to it won't be an issue for the '.onmiss' callback.

Edited by CarlZalph
line number

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

×
  • Create New...