Fix crash when saving AudioPlayer without stream.

Guards against calling this setter with invalid input.
This commit is contained in:
Andreas Haas 2017-05-20 03:49:24 +02:00
parent 6fd217d7c3
commit 02aa1dd600
No known key found for this signature in database
GPG key ID: B5FFAE1B65FBD2E1

View file

@ -113,6 +113,7 @@ void AudioPlayer::_notification(int p_what) {
void AudioPlayer::set_stream(Ref<AudioStream> p_stream) {
ERR_FAIL_COND(!p_stream.is_valid());
AudioServer::get_singleton()->lock();
mix_buffer.resize(AudioServer::get_singleton()->thread_get_mix_buffer_size());