Skip to content

Commit

Permalink
Fixed null ref error for some characters
Browse files Browse the repository at this point in the history
  • Loading branch information
devyndamonster committed Oct 31, 2021
1 parent 243fd32 commit 4668abb
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions ObjectTemplates/CustomCharacter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ public TNH_CharacterDef GetCharacter(int ID, Sprite thumbnail)
{
if(character == null)
{
if (ValidAmmoSets == null) ValidAmmoSets = new List<TagSet>();
if (ValidAmmoEras == null) ValidAmmoEras = new List<TagEra>();

character = (TNH_CharacterDef)ScriptableObject.CreateInstance(typeof(TNH_CharacterDef));
character.DisplayName = DisplayName;
Expand Down Expand Up @@ -606,6 +608,22 @@ public ObjectTableDef GetObjectTableDef()
{
if(objectTableDef == null)
{
if (Eras == null) Eras = new List<TagEra>();
if (Sets == null) Sets = new List<TagSet>();
if (Sizes == null) Sizes = new List<TagFirearmSize>();
if (Actions == null) Actions = new List<TagFirearmAction>();
if (Modes == null) Modes = new List<TagFirearmFiringMode>();
if (ExcludedModes == null) ExcludedModes = new List<TagFirearmFiringMode>();
if (FeedOptions == null) FeedOptions = new List<TagFirearmFeedOption>();
if (MountsAvailable == null) MountsAvailable = new List<TagFirearmMount>();
if (RoundPowers == null) RoundPowers = new List<TagFirearmRoundPower>();
if (Features == null) Features = new List<TagAttachmentFeature>();
if (MeleeHandedness == null) MeleeHandedness = new List<TagMeleeHandedness>();
if (MeleeStyles == null) MeleeStyles = new List<TagMeleeStyle>();
if (PowerupTypes == null) PowerupTypes = new List<TagPowerupType>();
if (ThrownTypes == null) ThrownTypes = new List<TagThrownType>();
if (ThrownDamageTypes == null) ThrownDamageTypes = new List<TagThrownDamageType>();

objectTableDef = (ObjectTableDef)ScriptableObject.CreateInstance(typeof(ObjectTableDef));
objectTableDef.Category = (FVRObject.ObjectCategory)Category;
objectTableDef.MinAmmoCapacity = MinAmmoCapacity;
Expand Down

0 comments on commit 4668abb

Please sign in to comment.