From 9abfef9b12a3a6b1ee343bea3d466528c1ae1529 Mon Sep 17 00:00:00 2001 From: Iajret Creature <122297233+Steals-The-PRs@users.noreply.github.com> Date: Sun, 19 Nov 2023 20:18:47 +0300 Subject: [PATCH] [MIRROR] Fixes admin spawned bitrunning events [No GBP] [MDB IGNORE] (#710) * Fixes admin spawned bitrunning events [No GBP] (#79820) --------- Co-authored-by: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com> --- code/modules/bitrunning/event.dm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/code/modules/bitrunning/event.dm b/code/modules/bitrunning/event.dm index 94089f11203..4cc95f4f057 100644 --- a/code/modules/bitrunning/event.dm +++ b/code/modules/bitrunning/event.dm @@ -77,12 +77,17 @@ /datum/round_event/ghost_role/bitrunning_glitch/spawn_role() var/datum/round_event_control/bitrunning_glitch/cyber_control = control + if(!length(cyber_control.active_servers)) + return WAITING_FOR_SOMETHING - var/obj/machinery/quantum_server/unlucky_server = pick(cyber_control.active_servers) - cyber_control.active_servers.Cut() + var/datum/weakref/server_ref = pick(cyber_control.active_servers) + var/obj/machinery/quantum_server/unlucky_server = server_ref?.resolve() + if(isnull(unlucky_server)) + return WAITING_FOR_SOMETHING + cyber_control.active_servers.Cut() if(!unlucky_server.validate_mutation_candidates()) - return MAP_ERROR + return WAITING_FOR_SOMETHING spawned_mobs = unlucky_server.setup_glitch(forced_role)