KnuckleCracker / CW4-bug-tracker

The gathering point for bugs and supporting information, or suggestions about additional features.
Creative Commons Attribution Share Alike 4.0 International
13 stars 2 forks source link

[4RPL] GetUnitSettings throws exception when used on a custom unit with no scripts attached. #1074

Open Durikkan opened 1 year ago

Durikkan commented 1 year ago

K75 requested I post this bug here. Calling GetUnitSettings (Or SetUnitSettings) on a custom unit that does not have a script attached throws an exception. If the unit has a script, it works normally, even if it's completely blank.

Attached is a tiny map that causes this exception to be thrown whenever you advance a gameplay frame as it attempts to call GetUnitSettings on a unit with no scripts attached.

Also the error for reference.
NullReferenceException: Object reference not set to an instance of an object. at CModUnitManager.GetUnitSettings () [0x00000] in <00000000000000000000000000000000>:0 at CModRplCore.HandleUnitCommands (RplCore+Command command) [0x00000] in <00000000000000000000000000000000>:0 at RplCore.ProcessCommands (System.Boolean start, System.Boolean onceP, System.Boolean final, System.Boolean gameLoaded, System.String eventName, System.Boolean paused) [0x00000] in <00000000000000000000000000000000>:0 at RplCore.GameUpdate (System.Boolean final, System.Boolean paused) [0x00000] in <00000000000000000000000000000000>:0 at CModUnitManager.GameUpdate () [0x00000] in <00000000000000000000000000000000>:0 at GameSpace.MyFixedUpdate () [0x00000] in <00000000000000000000000000000000>:0 at GameSpace.Update () [0x00000] in <00000000000000000000000000000000>:0

save.zip