diff --git a/code/controllers/subsystem/blackbox.dm b/code/controllers/subsystem/blackbox.dm
index 4d63491b02..f25244a6b1 100644
--- a/code/controllers/subsystem/blackbox.dm
+++ b/code/controllers/subsystem/blackbox.dm
@@ -257,10 +257,18 @@ Versioning
/datum/controller/subsystem/blackbox/proc/ReportDeath(mob/living/L)
if(sealed)
return
- if(!SSdbcore.Connect())
- return
if(!L || !L.key || !L.mind)
return
+ if(!L.suiciding && !first_death.len)
+ first_death["name"] = "[(L.real_name == L.name) ? L.real_name : "[L.real_name] as [L.name]"]"
+ first_death["role"] = null
+ if(L.mind.assigned_role)
+ first_death["role"] = L.mind.assigned_role
+ first_death["area"] = "[AREACOORD(L)]"
+ first_death["damage"] = "[L.getBruteLoss()]/[L.getFireLoss()]/[L.getToxLoss()]/[L.getOxyLoss()]/[L.getCloneLoss()]"
+ first_death["last_words"] = L.last_words
+ if(!SSdbcore.Connect())
+ return
var/area/placeofdeath = get_area(L)
var/sqlname = sanitizeSQL(L.real_name)
var/sqlkey = sanitizeSQL(L.ckey)
@@ -282,13 +290,5 @@ Versioning
var/last_words = sanitizeSQL(L.last_words)
var/suicide = sanitizeSQL(L.suiciding)
var/map = sanitizeSQL(SSmapping.config.map_name)
- if(!L.suiciding && !first_death.len)
- first_death["name"] = "[(L.real_name == L.name) ? L.real_name : "[L.real_name] as [L.name]"]"
- first_death["role"] = null
- if(L.mind.assigned_role)
- first_death["role"] = L.mind.assigned_role
- first_death["area"] = "[AREACOORD(L)]"
- first_death["damage"] = "[sqlbrute]/[sqlfire]/[sqltox]/[sqloxy]/[sqlclone]"
- first_death["last_words"] = L.last_words
var/datum/DBQuery/query_report_death = SSdbcore.NewQuery("INSERT INTO [format_table_name("death")] (pod, x_coord, y_coord, z_coord, mapname, server_ip, server_port, round_id, tod, job, special, name, byondkey, laname, lakey, bruteloss, fireloss, brainloss, oxyloss, toxloss, cloneloss, staminaloss, last_words, suicide) VALUES ('[sqlpod]', '[x_coord]', '[y_coord]', '[z_coord]', '[map]', INET_ATON(IF('[world.internet_address]' LIKE '', '0', '[world.internet_address]')), '[world.port]', [GLOB.round_id], '[SQLtime()]', '[sqljob]', '[sqlspecial]', '[sqlname]', '[sqlkey]', '[laname]', '[lakey]', [sqlbrute], [sqlfire], [sqlbrain], [sqloxy], [sqltox], [sqlclone], [sqlstamina], '[last_words]', [suicide])")
- query_report_death.Execute()
+ query_report_death.Execute()
\ No newline at end of file