From 601a0722a7340f14c85fcf7eec372961c8b542b7 Mon Sep 17 00:00:00 2001 From: Lyuma Date: Wed, 27 Oct 2021 16:06:09 -0700 Subject: [PATCH] Mitigate crash in AudioStreamPlayer3D when a camera has null viewport --- scene/3d/audio_stream_player_3d.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp index c422070480a..3f91bce6b31 100644 --- a/scene/3d/audio_stream_player_3d.cpp +++ b/scene/3d/audio_stream_player_3d.cpp @@ -383,7 +383,13 @@ Vector AudioStreamPlayer3D::_update_panning() { PhysicsDirectSpaceState3D *space_state = PhysicsServer3D::get_singleton()->space_get_direct_state(world_3d->get_space()); for (Camera3D *camera : cameras) { + if (!camera) { + continue; + } Viewport *vp = camera->get_viewport(); + if (!vp) { + continue; + } if (!vp->is_audio_listener_3d()) { continue; }