diff options
author | Paulb23 <p_batty@hotmail.co.uk> | 2021-09-01 16:44:47 +0100 |
---|---|---|
committer | Paulb23 <p_batty@hotmail.co.uk> | 2021-09-01 16:46:04 +0100 |
commit | cd6b11222c59d256bb21c7a48b2e54d3d4141d86 (patch) | |
tree | 809949d630aab7ea5a5471569c72b9afdb24c809 | |
parent | ac7541c1b1f435587afb1d7b74129c813a1c84dc (diff) |
Prevent crash on startup if no audio server
-rw-r--r-- | scene/main/viewport.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 8ec8c193fb..e69f8cd9f7 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -822,7 +822,9 @@ Rect2 Viewport::get_visible_rect() const { } void Viewport::_update_listener_2d() { - AudioServer::get_singleton()->notify_listener_changed(); + if (AudioServer::get_singleton()) { + AudioServer::get_singleton()->notify_listener_changed(); + } } void Viewport::set_as_audio_listener_2d(bool p_enable) { @@ -3075,7 +3077,9 @@ bool Viewport::is_audio_listener_3d() const { } void Viewport::_update_listener_3d() { - AudioServer::get_singleton()->notify_listener_changed(); + if (AudioServer::get_singleton()) { + AudioServer::get_singleton()->notify_listener_changed(); + } } void Viewport::_listener_transform_3d_changed_notify() { |