NullReferenceException at OnEntitySpawnedFixed

Tested solo and get these errors:

(21:59:27) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <68d64b8739574f62bc3e8c430918b992>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <4452f821def6406d834e4149849fe7ea>:0
(21:59:27) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <68d64b8739574f62bc3e8c430918b992>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <4452f821def6406d834e4149849fe7ea>:0
(21:59:27) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <68d64b8739574f62bc3e8c430918b992>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <4452f821def6406d834e4149849fe7ea>:0
(21:59:27) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <68d64b8739574f62bc3e8c430918b992>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <4452f821def6406d834e4149849fe7ea>:0
(21:59:27) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <68d64b8739574f62bc3e8c430918b992>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <4452f821def6406d834e4149849fe7ea>:0
(21:59:27) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <68d64b8739574f62bc3e8c430918b992>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <4452f821def6406d834e4149849fe7ea>:0
(21:59:27) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <68d64b8739574f62bc3e8c430918b992>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <4452f821def6406d834e4149849fe7ea>:0
(21:59:27) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <68d64b8739574f62bc3e8c430918b992>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <4452f821def6406d834e4149849fe7ea>:0
(21:59:27) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <68d64b8739574f62bc3e8c430918b992>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <4452f821def6406d834e4149849fe7ea>:0
(21:59:27) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <68d64b8739574f62bc3e8c430918b992>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <4452f821def6406d834e4149849fe7ea>:0
(21:59:27) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <68d64b8739574f62bc3e8c430918b992>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <4452f821def6406d834e4149849fe7ea>:0

Any solution to this ?

I been hacking at this and improved the null checking as Wulf suggested.

The only outstanding bug is with:
tooHotUntil.SetValue(debris, Time.realtimeSinceStartup + configs.options.gibsHotDelay);

I will see if I can solve that one too.
how to fix it

how to fix it???

I'm seeing NREs when the Bradley dies. It all seems to work fine, there's just a load of console spam. Plugin v0.2.2.

Oxide.Rust Version: 2.0.4960

Protocol: 2293.205.1

Build Date: 04/06/2021 10:54:46

Unity Version: 2019.4.22f1

Changeset: 60338

Branch: release


(18:28:14) | [Death Notes] PPlank blew up the Bradley APC with their rocket_smoke.
(18:28:14) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <014a55ad135b46d98d7213720febbcab>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <c2afd8354b8b4f3ca451cf5a1aa111c3>:0
(18:28:14) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <014a55ad135b46d98d7213720febbcab>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <c2afd8354b8b4f3ca451cf5a1aa111c3>:0
(18:28:14) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <014a55ad135b46d98d7213720febbcab>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <c2afd8354b8b4f3ca451cf5a1aa111c3>:0
(18:28:14) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <014a55ad135b46d98d7213720febbcab>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <c2afd8354b8b4f3ca451cf5a1aa111c3>:0
(18:28:14) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <014a55ad135b46d98d7213720febbcab>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <c2afd8354b8b4f3ca451cf5a1aa111c3>:0
(18:28:14) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <014a55ad135b46d98d7213720febbcab>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <c2afd8354b8b4f3ca451cf5a1aa111c3>:0
(18:28:14) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <014a55ad135b46d98d7213720febbcab>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <c2afd8354b8b4f3ca451cf5a1aa111c3>:0
(18:28:14) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <014a55ad135b46d98d7213720febbcab>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <c2afd8354b8b4f3ca451cf5a1aa111c3>:0
(18:28:14) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <014a55ad135b46d98d7213720febbcab>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <c2afd8354b8b4f3ca451cf5a1aa111c3>:0
(18:28:14) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <014a55ad135b46d98d7213720febbcab>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <c2afd8354b8b4f3ca451cf5a1aa111c3>:0
(18:28:14) | Exception while calling NextTick callback (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.BradleyControl+<OnEntitySpawned>c__AnonStorey0.<>m__0 () [0x0008c] in <014a55ad135b46d98d7213720febbcab>:0 
  at Oxide.Core.OxideMod.OnFrame (System.Single delta) [0x00051] in <c2afd8354b8b4f3ca451cf5a1aa111c3>:0​
Locked automatically