Prevent a crash in ExternalIVR when the 'S' command is sent first.
If the first command sent from an ExternalIVR client is an 'S' command, we were
blindly removing the first element from the play list and deferencing it, even
if it was NULL. This corrects that and also locks appropriately in one place.
(issue ASTERISK-17889)
Reported by: Chris Maciejewski
........
Merged revisions 362586 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 362587 from http://svn.asterisk.org/svn/asterisk/branches/10
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362588
65c4cc65-6c06-0410-ace0-
fbb531ad65f3