Skip to content

Commit

Permalink
v1.0.1
Browse files Browse the repository at this point in the history
Fixed the NullReferenceException when attempting to bond with an animal before any rules have been set
  • Loading branch information
Jaxe-Wilde committed Aug 21, 2018
1 parent ebe8f7f commit 1575cea
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion About/ModSync.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ModSyncNinjaData>
<ID>59f538ed-f86d-4506-a4a5-7e9faaa37509</ID>
<ModName>Pawn Rules</ModName>
<Version>v1.0-rw0.19</Version>
<Version>v1.0.1</Version>
<SaveBreaking>False</SaveBreaking>
<Host name="Github">
<Owner>Jaxe-Dev</Owner>
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Pawn Rules
#### Version 1.0
![](https://img.shields.io/badge/Version-1.0.1-brightgreen.svg)

Built for **RimWorld 1.0.x / 0.19.x**\
Powered by **Harmony**\
Supports **ModSync RW**

[Link to Ludeon Forum Post](https://ludeon.com/forums/index.php?topic=43086.0)
Expand Down
2 changes: 1 addition & 1 deletion Source/Mod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ internal class Mod : Verse.Mod
public const string Id = "PawnRules";
public const string Name = "Pawn Rules";
public const string Author = "Jaxe";
public const string Version = "1.0";
public const string Version = "1.0.1";

public static ModContentPack ContentPack { get; private set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ internal static class RimWorld_RelationsUtility_TryDevelopBondRelation
{
private static bool Prefix(Pawn humanlike, Pawn animal)
{
if (!Registry.IsActive || !humanlike.CanHaveRules()) { return true; }
if (!Registry.IsActive || (humanlike == null) || (animal == null) || !humanlike.CanHaveRules()) { return true; }

var rules = Registry.GetRules(humanlike);
if (rules == null) { return true; }
var restrictions = rules.GetRestriction(RestrictionType.Bonding);
return (rules == null) || (restrictions.IsVoid) || restrictions.Allows(animal.def);
return (restrictions == null) || restrictions.IsVoid || restrictions.Allows(animal.def);
}
}
}

0 comments on commit 1575cea

Please sign in to comment.