Fixed possible issue with script event lists being indexed out of range if an event was unregistered during the invocation of another script event.
Merge pull request #959 from sgrenier/next

Fixed possible issue with script event lists being indexed out of range.