From 04b44a1f89d5dde7250bbc1fe39ac49c5270394c Mon Sep 17 00:00:00 2001
From: DarkGod <darkgod@net-core.org>
Date: Wed, 8 Jul 2020 16:00:20 +0200
Subject: [PATCH] Made the death code resilient to entities without name

---
 game/modules/tome/class/interface/PartyDeath.lua | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/game/modules/tome/class/interface/PartyDeath.lua b/game/modules/tome/class/interface/PartyDeath.lua
index cca7a45e88..062f5d52cb 100644
--- a/game/modules/tome/class/interface/PartyDeath.lua
+++ b/game/modules/tome/class/interface/PartyDeath.lua
@@ -88,7 +88,11 @@ function _M:onPartyDeath(src, death_note)
 		if not death_note.special_death_msg then
 			msg = _t"%s the level %d %s %s was %s to death by %s%s%s on level %s of %s."
 			short_msg = _t"%s(%d %s %s) was %s to death by %s%s on %s %s."
-			local srcname = src.unique and src:getName() or src:getName():a_an()
+			local srcname
+			if src.getName and src.unique then srcname = src:getName()
+			elseif src.getName then srcname = src:getName():a_an()
+			else srcname = src.name and tostring(src.name) or "(???)"
+			end
 			local killermsg = (src.killer_message and " "..src.killer_message or ""):gsub("#sex#", game.player.female and _t"her" or _t"him")
 			if src.name == game.player.name then
 				srcname = game.player.female and _t"herself" or _t"himself"
-- 
GitLab