Issue Data
|
Issue #20640: SpotLightTriggerScript - Cannot clear a None array
[05/27/2016 - 06:22:20PM] error: Cannot clear a None array
stack: [ (000D852B)].spotlighttriggerscript.Shutdown() - "<unknown file>" Line ? [ (000D84FA)].SpotlightScript.active.OnCellLoad() - "<unknown file>" Line ? [05/27/2016 - 06:22:20PM] error: Cannot clear a None array stack: [ (000D84E3)].spotlighttriggerscript.Shutdown() - "<unknown file>" Line ? [ (000D84D8)].SpotlightScript.active.OnCellLoad() - "<unknown file>" Line ? [05/27/2016 - 06:22:20PM] error: Cannot clear a None array stack: [ (000D84E3)].spotlighttriggerscript.Shutdown() - "<unknown file>" Line ? [ (000D84D8)].SpotlightScript.active.OnCellLoad() - "<unknown file>" Line ? [05/27/2016 - 06:22:20PM] error: Cannot clear a None array stack: [ (000D852B)].spotlighttriggerscript.Shutdown() - "<unknown file>" Line ? [ (000D84FA)].SpotlightScript.active.OnCellLoad() - "<unknown file>" Line ? Remotely related to bug no. 20636 (that post has additional information). The arrays in question are supposed to be initialized in the OnLoad event of spotlighttriggerscript. This may not yet have happened though when the spotlightscript calls the Shutdown function on spotlighttriggerscript. Therefore, sanity checks are needed in the Shutdown function. The fix goes a little farther in that it initializes the arrays as zero-length arrays if they are none (as this is how an array that is not none would end up anyway after the Clear function has run). The OnLoad event of spotlighttriggerscript already checks for the arrays being none before it initializes them, so it will not re-initialize them unwantedly when the Shutdown function has already run. Whatever code runs first - the Shutdown function or the OnLoad event - will now make sure that the arrays are initialized as zero-length arrays: <pre class="_prettyXprint _lang-"> Function Shutdown() GoToState("Shutdown" ;Clear the present detection array, we don't care what was in it. Only what is there when we turn the Spotlight back on. targetActorIndex = -1 ;debug.trace("CLEAR THE ARRAY!!!!" ;EDIT: Added sanity checks for triggerActors and detectedActorArray being none. If none, they will now be initialized as zero-length arrays ;(as this is how they would end up if they were not none after the clear function has run) if triggerActors triggerActors.Clear() else triggerActors = new objectReference[0] endif if detectedActorArray detectedActorArray.Clear() else detectedActorArray = new objectReference[0] endif mySpotlight.shutdown = true mySpotlight.mySpotlightLight.disable() if mySpotlight.startsoff mySpotlight.playAnimation("StartOff" else ;mySpotlight.playAnimation("TurnOff" endif ;We are shutdown and therefore should not be receiving any events. UnregisterForAllEvents() endFunction </pre> |
Showing Comments 1 - 1 of 1