mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-14 08:34:16 +01:00
Fix: Event manager list index out of bounds
This commit prevents a runtime of "list index out of bounds" with events by adding a simple sanity checking system, so that the list checked always has a valid check, regardless of if the event has a valid variable. NOTE: May result in unintended behaviour if an event tries to complete with an invalid severity level. It will always be set to moderate, as that is a safe assumption for the code to make.
This commit is contained in:
@@ -39,8 +39,19 @@
|
||||
|
||||
finished_events += E
|
||||
|
||||
var/theseverity
|
||||
|
||||
if(!E.severity)
|
||||
theseverity = EVENT_LEVEL_MODERATE
|
||||
|
||||
if(!E.severity == EVENT_LEVEL_MUNDANE && !E.severity == EVENT_LEVEL_MODERATE && !E.severity == EVENT_LEVEL_MAJOR)
|
||||
theseverity = EVENT_LEVEL_MODERATE //just to be careful
|
||||
|
||||
if(E.severity)
|
||||
theseverity = E.severity
|
||||
|
||||
// Add the event back to the list of available events
|
||||
var/datum/event_container/EC = event_containers[E.severity]
|
||||
var/datum/event_container/EC = event_containers[theseverity]
|
||||
var/datum/event_meta/EM = E.event_meta
|
||||
EC.available_events += EM
|
||||
|
||||
|
||||
Reference in New Issue
Block a user