NullReferenceException at ProtectedCupboard.UpdateTotalBuildingCostError

Here's what I'm getting in the console:

Failed to run a 1.00 timer in 'RaidProtection v2.1.7' (NullReferenceException: Object reference not set to an instance of an object)

at Oxide.Plugins.RaidProtection+ProtectedCupboard.UpdateTotalBuildingCost () [0x00123] in <7bde124e06004d438939bd3127f97e97>:0

at Oxide.Plugins.RaidProtection+ProtectedCupboard..ctor (BuildingPrivlidge priv) [0x000ca] in <7bde124e06004d438939bd3127f97e97>:0

at Oxide.Plugins.RaidProtection+ProtectedCupboard.InitCupboard (BuildingPrivlidge priv) [0x00030] in <7bde124e06004d438939bd3127f97e97>:0

at Oxide.Plugins.RaidProtection.<LoadAllTcs>m__0 () [0x00021] in <7bde124e06004d438939bd3127f97e97>:0

at Oxide.Core.Libraries.Timer+TimerInstance.FireCallback () [0x00018] in <12678b905a6d43c3a9cc366104306651>:0

When did this happen, was it when you reloaded the plugin or restarted the server?

Thanks so much for the quick turnaround and the awesome plugins!  The error occurs on reload or restart, doesn't seem to matter.  If I comment out LoadAllTcs() from the init function, it compiles and runs without the error.  I put it back in and commented out line 576-582 of RaidProtection.cs.  It compiles and runs properly, but of course inits no cupboards.  The error is occuring during that foreach loop.  The result seems similar to the problem I was having before, but there was no error generated then.  When I reload the plugin or server restarts, the TC balances and protection status are reset to 0 bal/unprotected.  I also tried deleting the plugin and redownloading/installing.  Tried deleting the config/data/CupboardBalances.json and letting them regen to see if those were corrupted and causing the error, but problem still persists.  Here are my other plugins in case I'm an outlier and it's a conflict or something:

01 "Admin AntiHack Fix" (1.0.0) by Solarix (0.00s) - AdminAntiHackFix.cs

02 "Admin Radar" (5.1.5) by nivex (49.95s) - AdminRadar.cs

03 "AutoBroadcast" (1.0.8) by Wulf/lukespragg (0.03s) - AutoBroadcast.cs

04 "Automatic Authorization" (1.3.0) by k1lly0u/Arainrr (0.96s) - AutomaticAuthorization.cs

05 "Backpacks" (3.7.2) by LaserHydra (0.61s) - Backpacks.cs

06 "Better Chat" (5.2.7) by LaserHydra (0.00s) - BetterChat.cs

07 "BGrade" (1.1.3) by Ryan / Rustoria.co (0.01s) - BGrade.cs

08 "Blueprint Manager" (1.1.6) by Orange (0.02s) - BlueprintManager.cs

09 "Bounty" (0.2.6) by k1lly0u (1.42s) - Bounty.cs

10 "Building Grades" (1.0.4) by Default/Arainrr (0.00s) - BuildingGrades.cs

11 "Clans" (0.2.5) by k1lly0u (0.08s) - Clans.cs

12 "Clear Night" (2.3.5) by Clearshot (0.79s) - ClearNight.cs

13 "Copy Paste" (4.1.31) by misticos (0.22s) - CopyPaste.cs

14 "Crafting Controller" (3.2.2) by Whispers88 (0.05s) - CraftingController.cs

15 "CustomChatCommands" (2.1.2) by PsychoTea (0.05s) - CustomChatCommands.cs

16 "Custom Vending Setup" (2.2.0) by WhiteThunder (0.70s) - CustomVendingSetup.cs

17 "Disable Temperature Functions" (1.0.0) by Orange (0.00s) - DisableTemperatureFunctions.cs

18 "Discord Core" (2.0.3) by MJSU (0.08s) - DiscordCore.cs

19 "Discord Rewards" (1.4.0) by birthdates (0.01s) - DiscordRewards.cs

20 "Discord Roles" (2.0.6) by MJSU (0.02s) - DiscordRoles.cs

21 "EasyVote" (2.0.43) by Exel80 (0.01s) - EasyVote.cs

22 "Economics" (3.9.1) by Wulf (0.18s) - Economics.cs

23 "Entity Owner" (3.4.0) by Calytic (0.01s) - EntityOwner.cs

24 "Eternal Plants" (1.0.0) by 0x89A (0.00s) - EternalPlants.cs

25 "Extended Recycler" (1.1.1) by Orange (0.41s) - ExtendedRecycler.cs

26 "Farm Tools" (1.2.0) by Clearshot (0.00s) - FarmTools.cs

27 "Furnace Splitter" (2.3.1) by FastBurst (4.62s) - FurnaceSplitter.cs

28 "Gathering Manager" (2.2.75) by Mughisi (0.40s) - GatherManager.cs

29 "Gather Rewards" (1.5.8) by Shady14u (0.08s) - GatherRewards.cs

30 "GUIShop" (2.3.11) by Khan (0.99s) - GUIShop.cs

31 "HitIcon" (2.0.0) by FastBurst (0.03s) - HitIcon.cs

32 "Hostile Time" (1.0.2) by Orange (0.01s) - HostileTime.cs

33 "Image Library" (2.0.58) by Absolut & K1lly0u (0.79s) - ImageLibrary.cs

34 "Instant Gather" (1.0.6) by supreme (0.00s) - InstantGather.cs

35 "Kits" (4.0.14) by k1lly0u (1.32s) - Kits.cs

36 "Magic Airdrop Panel" (1.0.1) by MJSU (0.74s) - MagicAirdropPanel.cs

37 "Magic Bradley Panel" (1.0.1) by MJSU (0.53s) - MagicBradleyPanel.cs

38 "Magic Cargo Ship Panel" (1.0.1) by MJSU (0.48s) - MagicCargoShipPanel.cs

39 "Magic Ch47 Panel" (1.0.1) by MJSU (0.47s) - MagicCh47Panel.cs

40 "Magic Clock Panel" (1.0.1) by MJSU (0.17s) - MagicClockPanel.cs

41 "Magic Economics Panel" (1.0.5) by MJSU (0.01s) - MagicEconomicsPanel.cs

42 "Magic Fps Panel" (1.0.2) by MJSU (0.29s) - MagicFpsPanel.cs

43 "Magic Heli Panel" (1.0.2) by MJSU (0.82s) - MagicHeliPanel.cs

44 "Magic Loot" (1.0.5) by collect_vood (210.18s) - MagicLoot.cs

45 "Magic Panel" (1.0.6) by MJSU (0.58s) - MagicPanel.cs

46 "Magic Ping Panel" (1.0.5) by MJSU (0.04s) - MagicPingPanel.cs

47 "Magic Players Panel" (1.0.2) by MJSU (0.00s) - MagicPlayersPanel.cs

48 "MAPLOCK" (1.0.0) by bmgjet (0.42s) - MAPLOCK.cs

49 "Metabolism" (1.0.0) by Orange (0.00s) - Metabolism.cs

50 "Monument Finder" (3.0.0) by WhiteThunder (0.07s) - MonumentFinder.cs

51 "Nav Mesh Error Fix" (1.1.0) by Ryz0r (0.00s) - NavMeshErrorFix.cs

52 "No Escape" (2.1.35) by Calytic (0.89s) - NoEscape.cs

53 "No Give Notices" (0.3.0) by Wulf (0.00s) - NoGiveNotices.cs

54 "No Vehicle Collision Damage" (0.0.8) by bsdinis (0.53s) - NoVehicleCollisionDamage.cs

55 "NoWorkbench" (0.1.51) by k1lly0u (0.01s) - NoWorkbench.cs

56 "NTeleportation" (1.6.8) by nivex (0.82s) - NTeleportation.cs

57 "PermissionsManager" (2.0.5) by Steenamaroo (0.09s) - PermissionsManager.cs

58 "Playtime Tracker" (0.2.2) by k1lly0u (0.62s) - PlaytimeTracker.cs

59 "Quick Smelt" (5.1.3) by Iv Misticos (3.06s) - QuickSmelt.cs

60 "Raidable Bases" (2.4.1) by nivex (2.26s) - RaidableBases.cs

61 "Raid Protection" (2.1.7) by mr01sam (0.62s) - RaidProtection.cs

62 "Recycler Speed" (2.0.2) by Ryz0r/yetzt (0.00s) - RecyclerSpeed.cs

63 "Remover Tool" (4.3.29) by Reneb/Fuji/Arainrr (0.03s) - RemoverTool.cs

64 "SAMSiteAuth" (2.3.4) by haggbart (0.00s) - SAMSiteAuth.cs

65 "SandMFix" (1.0.0) by bmgjet (1.08s) - SandMFix.cs

66 "Sign Artist" (1.2.6) by Whispers88 (0.01s) - SignArtist.cs

67 "Skins" (2.2.2) by misticos (2.89s) - Skins.cs

68 "Slap" (2.0.1) by Wulf (0.00s) - Slap.cs

69 "SmoothRestarter" (3.1.1) by 2CHEVSKII (0.01s) - SmoothRestarter.cs

70 "Stack Size Controller" (3.4.3) by AnExiledGod (10.99s) - StackSizeController.cs

71 "Tebex Donate" (1.7.0) by Tebex (1.07s) - TebexDonate.cs

72 "Trade" (1.2.43) by Calytic (0.00s) - Trade.cs

73 "Vanish" (1.5.5) by Whispers88 (0.01s) - Vanish.cs

74 "VIP Trial" (1.3.5) by Maik8 (0.00s) - VIPTrial.cs

75 "Workcart Spawner" (1.1.8) by SPooCK (15.97s) - WorkcartSpawner.cs

76 "ZombieHorde" (0.4.7) by k1lly0u (60.90s) - ZombieHorde.cs

77 "Zone Manager" (3.0.23) by k1lly0u (7.04s) - ZoneManager.cs

Wow, thanks for the detailed investigation, that will make it so much more likely that I can solve the issue. I'll look into this as soon as I can!

I've done a little C#, python, java in my life, but mostly embedded.  I've actually been playing with it trying to solve the issue myself and just don't have the skills.  Sorry I couldn't help more.  I'm actually excited to see the solution and hoping it's not something stupid on my end.

Solved in upcoming update

| Failed to run a 1.00 timer in 'RaidProtection v2.1.7' (NullReferenceException: Object reference not set to an instance of an object)
  at Oxide.Plugins.RaidProtection+ProtectedCupboard.UpdateTotalBuildingCost () [0x00046] in <69226a4c958749b6a6e10d97a00c217b>:0 
  at Oxide.Plugins.RaidProtection+ProtectedCupboard..ctor (BuildingPrivlidge priv) [0x000ca] in <69226a4c958749b6a6e10d97a00c217b>:0 
  at Oxide.Plugins.RaidProtection+ProtectedCupboard.InitCupboard (BuildingPrivlidge priv) [0x00030] in <69226a4c958749b6a6e10d97a00c217b>:0 
  at Oxide.Plugins.RaidProtection.<LoadAllTcs>m__0 () [0x0002b] in <69226a4c958749b6a6e10d97a00c217b>:0 
  at Oxide.Core.Libraries.Timer+TimerInstance.FireCallback () [0x00018] in <50629aa0e75d4126b345d8d9d64da28d>:0​

Hello guys, when i just try to load the plugin on the server i just got this error.

If someone can help my i will apreciate it :D 

Have a good day