From 255ee03aee7122f83afbb26276249433f55444b4 Mon Sep 17 00:00:00 2001 From: Zebbeni Date: Fri, 29 Apr 2022 13:30:32 -0600 Subject: [PATCH] prevent crash on unknown drowning figure --- backend/model/events.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/model/events.go b/backend/model/events.go index 71b04e7..036bbd9 100644 --- a/backend/model/events.go +++ b/backend/model/events.go @@ -948,7 +948,10 @@ func (x *HistoricalEventHfDied) Html(c *Context) string { case HistoricalEventHfDiedCause_Suffocate, HistoricalEventHfDiedCause_Air: return hf + " suffocated, slain by " + slayer + loc case HistoricalEventHfDiedCause_SuicideDrowned, HistoricalEventHfDiedCause_DrownAltTwo: - return hf + " drowned " + util.If(c.World.HistoricalFigures[x.Hfid].Female(), "herself ", "himself ") + loc + if f, ok := c.World.HistoricalFigures[x.Hfid]; ok { + return hf + " drowned " + util.If(f.Female(), "herself ", "himself ") + loc + } + return hf + " drowned themselves " + loc case HistoricalEventHfDiedCause_SuicideLeaping, HistoricalEventHfDiedCause_LeaptFromHeight: return hf + " leapt from a great height" + loc case HistoricalEventHfDiedCause_Thirst: