Jump to content

NRE + Stacktrace

Work in Progress 0.1.5

Stewie
Stewie

Posted

You may want to review updating this plugin with some additional NRE checks and also looking into the conflict between the plugin and rusts current decay system. You can recreate this stacktrace if you adjust your decay.scale to 3 or higher.

[2025.05.02 12:28:39] [ERRO] Unhandled error occurred (NullReferenceException)
  at BaseEntity.WorldSpaceBounds () (at <18f552e21ad945a4ae7147de4e0152ee>:0)
  at BaseEntity.GetNearestBuildingPrivilege (System.Boolean cached, System.Single cacheDuration) (at <18f552e21ad945a4ae7147de4e0152ee>:0)
  at BaseEntity.GetBuildingPrivilege () (at <18f552e21ad945a4ae7147de4e0152ee>:0)
  at DecayEntity.GetBuildingPrivilege () (at <18f552e21ad945a4ae7147de4e0152ee>:0)
  at (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.DecayEntity.OnDecay_Patch0(DecayEntity,Decay,single)
  at DecayEntity.DecayTick () (at <18f552e21ad945a4ae7147de4e0152ee>:0)
  at ServerBuildingManager.Cycle () (at <18f552e21ad945a4ae7147de4e0152ee>:0)
  at ServerMgr.Update () (at <18f552e21ad945a4ae7147de4e0152ee>:0)
  at UnityEngine.Debug:LogException(Exception, Object)
  at ServerMgr:Update()


This would play better with the current rust version:

block.Hurt(_damage, DamageType.Decay);


and this is what I think you are missing from your existing NRE checks:

!_block.IsValid()

 

IIIaKa

Posted

Changed Status from Pending to Work in Progress

IIIaKa

Posted

On 5/2/2025 at 5:45 PM, Stewie said:

You may want to review updating this plugin with some additional NRE checks and also looking into the conflict between the plugin and rusts current decay system. You can recreate this stacktrace if you adjust your decay.scale to 3 or higher.

[2025.05.02 12:28:39] [ERRO] Unhandled error occurred (NullReferenceException)
  at BaseEntity.WorldSpaceBounds () (at <18f552e21ad945a4ae7147de4e0152ee>:0)
  at BaseEntity.GetNearestBuildingPrivilege (System.Boolean cached, System.Single cacheDuration) (at <18f552e21ad945a4ae7147de4e0152ee>:0)
  at BaseEntity.GetBuildingPrivilege () (at <18f552e21ad945a4ae7147de4e0152ee>:0)
  at DecayEntity.GetBuildingPrivilege () (at <18f552e21ad945a4ae7147de4e0152ee>:0)
  at (wrapper dynamic-method) MonoMod.Utils.DynamicMethodDefinition.DecayEntity.OnDecay_Patch0(DecayEntity,Decay,single)
  at DecayEntity.DecayTick () (at <18f552e21ad945a4ae7147de4e0152ee>:0)
  at ServerBuildingManager.Cycle () (at <18f552e21ad945a4ae7147de4e0152ee>:0)
  at ServerMgr.Update () (at <18f552e21ad945a4ae7147de4e0152ee>:0)
  at UnityEngine.Debug:LogException(Exception, Object)
  at ServerMgr:Update()

Hello. I didn't quite understand this message. I set decay.scale to 3, made twigs blocks, let them decay to 100% and didn’t get any error. Could you explain in more detail when it occurs?

IIIaKa

Posted (edited)

Thank you for the suggestions.

 

On 5/2/2025 at 5:45 PM, Stewie said:

This would play better with the current rust version:

block.Hurt(_damage, DamageType.Decay);

Could you please tell me the reason why you're suggesting to use Hurt method?
 

On 5/2/2025 at 5:45 PM, Stewie said:

and this is what I think you are missing from your existing NRE checks:

!_block.IsValid()

IsValid is an extension method that checks for != null and block.net != null. The plugin already checks for != null and I believe that checking net is not necessary in this context.

Edited by IIIaKa
1.8m

Downloads

Total number of downloads.

8.2k

Customers

Total customers served.

124.2k

Files Sold

Total number of files sold.

2.6m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.