mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
Check comp before copying enumerable
This commit is contained in:
parent
1013113718
commit
c9c96006cb
1 changed files with 7 additions and 5 deletions
|
@ -12,16 +12,18 @@ namespace RJWSexperience
|
|||
if (Find.Selector.NumSelected > 1)
|
||||
return;
|
||||
|
||||
__result = AddHistoryGizmo(__instance, __result);
|
||||
SexHistoryComp history = __instance.TryGetComp<SexHistoryComp>();
|
||||
if (history == null)
|
||||
return;
|
||||
|
||||
__result = AddHistoryGizmo(history, __result);
|
||||
}
|
||||
|
||||
private static IEnumerable<Gizmo> AddHistoryGizmo(Pawn pawn, IEnumerable<Gizmo> gizmos)
|
||||
private static IEnumerable<Gizmo> AddHistoryGizmo(SexHistoryComp history, IEnumerable<Gizmo> gizmos)
|
||||
{
|
||||
foreach (Gizmo gizmo in gizmos)
|
||||
yield return gizmo;
|
||||
|
||||
SexHistoryComp history = pawn.TryGetComp<SexHistoryComp>();
|
||||
if (history != null)
|
||||
yield return history.Gizmo;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue