diff --git a/code/controllers/subsystems/timer.dm b/code/controllers/subsystems/timer.dm index 37bc406905d..d973de097a6 100644 --- a/code/controllers/subsystems/timer.dm +++ b/code/controllers/subsystems/timer.dm @@ -359,10 +359,19 @@ var/datum/controller/subsystem/timer/SStimer /proc/addtimer(datum/callback/callback, wait, flags) if (!callback) - return + CRASH("addtimer called without a callback") + + if (wait < 0) + crash_with("addtimer called with a negative wait. Converting to 0") + + if (callback.object != GLOBAL_PROC && QDELETED(callback.object) && !QDESTROYING(callback.object)) + crash_with("addtimer called with a callback assigned to a qdeleted object. In the future such timers will not be supported and may refuse to run or run with a 0 wait") wait = max(wait, 0) + if(wait >= INFINITY) + CRASH("Attempted to create timer with INFINITY delay") + var/hash if (flags & TIMER_UNIQUE) diff --git a/code/datums/beam.dm b/code/datums/beam.dm index a3e3c11c421..12774f86e7a 100644 --- a/code/datums/beam.dm +++ b/code/datums/beam.dm @@ -149,6 +149,9 @@ return ..() /atom/proc/Beam(atom/BeamTarget,icon_state="b_beam",icon='icons/effects/beam.dmi',time=50, maxdistance=10,beam_type=/obj/effect/ebeam,beam_sleep_time = 3) + if(time >= INFINITY) + crash_with("Tried to create beam with infinite time!") + return null var/datum/beam/newbeam = new(src,BeamTarget,icon,icon_state,time,maxdistance,beam_type,beam_sleep_time) INVOKE_ASYNC(newbeam, /datum/beam/.proc/Start) return newbeam diff --git a/html/changelogs/Sindorman-timers.yml b/html/changelogs/Sindorman-timers.yml new file mode 100644 index 00000000000..7202573bbf1 --- /dev/null +++ b/html/changelogs/Sindorman-timers.yml @@ -0,0 +1,42 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: PoZe + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - backend: "Timers now have sanity checks, if wait time is negative or infinite. Or if there is no callback or if object is about to be deleted or already deleted. Gives call stack for negative wait time and deleted object. Crashes if wait time is infinite." + - backend: "Beams now have sanity check if it was trying to call timer with infinite wait time."