Check if doer exists in _Gendered precept comps

This commit is contained in:
amevarashi 2022-08-09 21:32:25 +05:00
parent 94088dca61
commit 7d6809dc2a
3 changed files with 7 additions and 4 deletions

View file

@ -11,9 +11,10 @@ namespace RJWSexperience.Ideology.Precepts
public override void Notify_MemberWitnessedAction(HistoryEvent ev, Precept precept, Pawn member)
{
Pawn doer = ev.args.GetArg<Pawn>(HistoryEventArgsNames.Doer);
if (doer.gender == doersGender)
if (ev.args.TryGetArg(HistoryEventArgsNames.Doer, out Pawn doer) && doer.gender == doersGender)
{
base.Notify_MemberWitnessedAction(ev, precept, member);
}
}
}
}

View file

@ -11,10 +11,11 @@ namespace RJWSexperience.Ideology.Precepts
public override void Notify_MemberTookAction(HistoryEvent ev, Precept precept, bool canApplySelfTookThoughts)
{
Pawn doer = ev.args.GetArg<Pawn>(HistoryEventArgsNames.Doer);
if (doer.gender == gender)
if (ev.args.TryGetArg(HistoryEventArgsNames.Doer, out Pawn doer) && doer.gender == gender)
{
TakeThought(ev, precept, canApplySelfTookThoughts, doer);
}
}
/// <summary>
/// This is a copy of base.Notify_MemberTookAction, but with partner handling

View file

@ -42,6 +42,7 @@
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
<Compile Include="DebugAction.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Ideology\HistoryEvents\DefExtension_SecondaryEvents.cs" />
<Compile Include="Ideology\HistoryEvents\DefExtension_EventOverrides.cs" />