diff --git a/code/modules/mob/dead/new_player/login.dm b/code/modules/mob/dead/new_player/login.dm index 89f1ae5260a..91aa6b932e9 100644 --- a/code/modules/mob/dead/new_player/login.dm +++ b/code/modules/mob/dead/new_player/login.dm @@ -3,8 +3,12 @@ return if(CONFIG_GET(flag/use_exp_tracking)) - client.set_exp_from_db() - client.set_db_player_flags() + client?.set_exp_from_db() + client?.set_db_player_flags() + if(!client) + // client disconnected during one of the db queries + return FALSE + if(!mind) mind = new /datum/mind(key) mind.active = TRUE @@ -44,6 +48,8 @@ var/datum/asset/asset_datum = get_asset_datum(/datum/asset/simple/lobby) asset_datum.send(client) + if(!client) // client disconnected during asset transit + return FALSE // The parent call for Login() may do a bunch of stuff, like add verbs. // Delaying the register_for_interview until the very end makes sure it can clean everything up diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index 1053b6672dd..a40c29459bc 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -1,5 +1,7 @@ /** - * Run when a client is put in this mob or reconnets to byond and their client was on this mob + * Run when a client is put in this mob or reconnets to byond and their client was on this mob. + * Anything that sleeps can result in the client reference being dropped, due to byond using that sleep to handle a client disconnect. + * You can save a lot of headache if you make Login use SHOULD_NOT_SLEEP, but that would require quite a bit of refactoring how Login code works. * * Things it does: * * Adds player to player_list