diff --git a/code/game/turfs/change_turf.dm b/code/game/turfs/change_turf.dm index 6d43a6173c1..87e9e13d26a 100644 --- a/code/game/turfs/change_turf.dm +++ b/code/game/turfs/change_turf.dm @@ -138,16 +138,15 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( /turf/open/ChangeTurf(path, list/new_baseturfs, flags) //Resist the temptation to make this default to keeping air. if ((flags & CHANGETURF_INHERIT_AIR) && ispath(path, /turf/open)) SSair.remove_from_active(src) - var/stashed_air = air - air = null // so that it doesn't get deleted + var/datum/gas_mixture/stashed_air = new() + stashed_air.copy_from(air) . = ..() - if (!. || . == src) // changeturf failed or didn't do anything - air = stashed_air + if (!.) // changeturf failed or didn't do anything + QDEL_NULL(stashed_air) return var/turf/open/newTurf = . - if (!istype(newTurf.air, /datum/gas_mixture/immutable/space)) - newTurf.air.copy_from(stashed_air) - QDEL_NULL(stashed_air) + newTurf.air.copy_from(stashed_air) + QDEL_NULL(stashed_air) SSair.add_to_active(newTurf) else if(ispath(path,/turf/closed))