summaryrefslogtreecommitdiff
path: root/scene/3d/audio_stream_player_3d.cpp
diff options
context:
space:
mode:
authorLyuma <xn.lyuma@gmail.com>2021-10-27 16:06:09 -0700
committerLyuma <xn.lyuma@gmail.com>2021-10-27 16:06:09 -0700
commit601a0722a7340f14c85fcf7eec372961c8b542b7 (patch)
tree6d3d338813a1b05a392d35088d3217cdf5fcd0e0 /scene/3d/audio_stream_player_3d.cpp
parentfa3164e90c31e74d9fb244e91453fb2f58154138 (diff)
Mitigate crash in AudioStreamPlayer3D when a camera has null viewport
Diffstat (limited to 'scene/3d/audio_stream_player_3d.cpp')
-rw-r--r--scene/3d/audio_stream_player_3d.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/scene/3d/audio_stream_player_3d.cpp b/scene/3d/audio_stream_player_3d.cpp
index c422070480..3f91bce6b3 100644
--- a/scene/3d/audio_stream_player_3d.cpp
+++ b/scene/3d/audio_stream_player_3d.cpp
@@ -383,7 +383,13 @@ Vector<AudioFrame> 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;
}