mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Fix null reference on missing hybrid def
This commit is contained in:
parent
4896f949ab
commit
fffd4f5f00
4 changed files with 9 additions and 4 deletions
Binary file not shown.
|
@ -492,7 +492,7 @@ namespace RJW_Menstruation
|
||||||
string MotherRaceName = "";
|
string MotherRaceName = "";
|
||||||
string FatherRaceName = "";
|
string FatherRaceName = "";
|
||||||
MotherRaceName = mother.kindDef?.race?.defName;
|
MotherRaceName = mother.kindDef?.race?.defName;
|
||||||
PawnKindDef tmp = spawn_kind_def;
|
PawnKindDef non_hybrid_kind_def = spawn_kind_def;
|
||||||
if (father != null)
|
if (father != null)
|
||||||
FatherRaceName = father.kindDef?.race?.defName;
|
FatherRaceName = father.kindDef?.race?.defName;
|
||||||
|
|
||||||
|
@ -507,7 +507,7 @@ namespace RJW_Menstruation
|
||||||
{
|
{
|
||||||
if (!Configurations.UseHybridExtention || spawn_kind_def == null)
|
if (!Configurations.UseHybridExtention || spawn_kind_def == null)
|
||||||
{
|
{
|
||||||
spawn_kind_def = tmp;
|
spawn_kind_def = non_hybrid_kind_def;
|
||||||
var groups = DefDatabase<RaceGroupDef>.AllDefs.Where(x => !(x.hybridRaceParents.NullOrEmpty() || x.hybridChildKindDef.NullOrEmpty()));
|
var groups = DefDatabase<RaceGroupDef>.AllDefs.Where(x => !(x.hybridRaceParents.NullOrEmpty() || x.hybridChildKindDef.NullOrEmpty()));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,9 +50,13 @@ namespace RJW_Menstruation
|
||||||
{
|
{
|
||||||
string key = hybridInfo.RandomElementByWeight(x => x.Value).Key;
|
string key = hybridInfo.RandomElementByWeight(x => x.Value).Key;
|
||||||
res = DefDatabase<PawnKindDef>.GetNamedSilentFail(key);
|
res = DefDatabase<PawnKindDef>.GetNamedSilentFail(key);
|
||||||
if (res == null) res = DefDatabase<ThingDef>.GetNamedSilentFail(key).race.AnyPawnKind;
|
if (res == null) res = DefDatabase<ThingDef>.GetNamedSilentFail(key)?.race?.AnyPawnKind;
|
||||||
|
|
||||||
if (res == null) hybridInfo.Remove(key);
|
if (res == null)
|
||||||
|
{
|
||||||
|
Log.Warning($"Could not find pawnKind or race {key}, removing hybrid definition");
|
||||||
|
hybridInfo.Remove(key);
|
||||||
|
}
|
||||||
} while (res == null && !hybridInfo.EnumerableNullOrEmpty());
|
} while (res == null && !hybridInfo.EnumerableNullOrEmpty());
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
Version 1.0.6.1
|
Version 1.0.6.1
|
||||||
- Fix error when bleeding rate set to 0.
|
- Fix error when bleeding rate set to 0.
|
||||||
|
- Fix errors when a hybrid refers to an invalid race.
|
||||||
- A pawn in estrus will prefer partners and sex types that would result in pregnancy.
|
- A pawn in estrus will prefer partners and sex types that would result in pregnancy.
|
||||||
- Optional (default disabled) alternative casual hookup settings for a pawn in visible estrus.
|
- Optional (default disabled) alternative casual hookup settings for a pawn in visible estrus.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue