mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 20:06:49 +01:00
Fix crash when passing null to AudioStreamPlayer::set_stream()
This commit is contained in:
parent
fab0dad4bb
commit
ff5bae8d0e
@ -276,7 +276,10 @@ void AudioStreamPlayer2D::_notification(int p_what) {
|
|||||||
|
|
||||||
void AudioStreamPlayer2D::set_stream(Ref<AudioStream> p_stream) {
|
void AudioStreamPlayer2D::set_stream(Ref<AudioStream> p_stream) {
|
||||||
// Instancing audio streams can cause large memory allocations, do it prior to AudioServer::lock.
|
// Instancing audio streams can cause large memory allocations, do it prior to AudioServer::lock.
|
||||||
Ref<AudioStreamPlayback> pre_instanced_playback = p_stream->instance_playback();
|
Ref<AudioStreamPlayback> pre_instanced_playback;
|
||||||
|
if (p_stream.is_valid()) {
|
||||||
|
pre_instanced_playback = p_stream->instance_playback();
|
||||||
|
}
|
||||||
|
|
||||||
AudioServer::get_singleton()->lock();
|
AudioServer::get_singleton()->lock();
|
||||||
|
|
||||||
|
@ -628,7 +628,10 @@ void AudioStreamPlayer3D::_notification(int p_what) {
|
|||||||
|
|
||||||
void AudioStreamPlayer3D::set_stream(Ref<AudioStream> p_stream) {
|
void AudioStreamPlayer3D::set_stream(Ref<AudioStream> p_stream) {
|
||||||
// Instancing audio streams can cause large memory allocations, do it prior to AudioServer::lock.
|
// Instancing audio streams can cause large memory allocations, do it prior to AudioServer::lock.
|
||||||
Ref<AudioStreamPlayback> pre_instanced_playback = p_stream->instance_playback();
|
Ref<AudioStreamPlayback> pre_instanced_playback;
|
||||||
|
if (p_stream.is_valid()) {
|
||||||
|
pre_instanced_playback = p_stream->instance_playback();
|
||||||
|
}
|
||||||
|
|
||||||
AudioServer::get_singleton()->lock();
|
AudioServer::get_singleton()->lock();
|
||||||
|
|
||||||
|
@ -168,7 +168,10 @@ void AudioStreamPlayer::_notification(int p_what) {
|
|||||||
|
|
||||||
void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) {
|
void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) {
|
||||||
// Instancing audio streams can cause large memory allocations, do it prior to AudioServer::lock.
|
// Instancing audio streams can cause large memory allocations, do it prior to AudioServer::lock.
|
||||||
Ref<AudioStreamPlayback> pre_instanced_playback = p_stream->instance_playback();
|
Ref<AudioStreamPlayback> pre_instanced_playback;
|
||||||
|
if (p_stream.is_valid()) {
|
||||||
|
pre_instanced_playback = p_stream->instance_playback();
|
||||||
|
}
|
||||||
|
|
||||||
AudioServer::get_singleton()->lock();
|
AudioServer::get_singleton()->lock();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user