diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-03 16:13:55 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-09-03 16:13:55 +0200 |
commit | d15de6f264bc3659310c19bc402a432e2ea896e3 (patch) | |
tree | deb293154752257941ca8852de4eec167ff9d3b7 /servers | |
parent | b104f218410669ec81ec9ffd4d8833b8aa30a554 (diff) | |
parent | 194bdde94787227e8f53a4e3273c192ab70b03ac (diff) | |
download | redot-engine-d15de6f264bc3659310c19bc402a432e2ea896e3.tar.gz |
Merge pull request #96292 from AThousandShips/null_check_ref_fix
Cleanup of raw `nullptr` checks with `Ref`
Diffstat (limited to 'servers')
-rw-r--r-- | servers/audio/effects/audio_effect_record.cpp | 10 | ||||
-rw-r--r-- | servers/xr_server.cpp | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/servers/audio/effects/audio_effect_record.cpp b/servers/audio/effects/audio_effect_record.cpp index 54af4738b1..6f358d54bb 100644 --- a/servers/audio/effects/audio_effect_record.cpp +++ b/servers/audio/effects/audio_effect_record.cpp @@ -149,7 +149,7 @@ Ref<AudioEffectInstance> AudioEffectRecord::instantiate() { ensure_thread_stopped(); bool is_currently_recording = false; - if (current_instance != nullptr) { + if (current_instance.is_valid()) { is_currently_recording = current_instance->is_recording; } if (is_currently_recording) { @@ -161,28 +161,28 @@ Ref<AudioEffectInstance> AudioEffectRecord::instantiate() { } void AudioEffectRecord::ensure_thread_stopped() { - if (current_instance != nullptr) { + if (current_instance.is_valid()) { current_instance->finish(); } } void AudioEffectRecord::set_recording_active(bool p_record) { if (p_record) { - if (current_instance == nullptr) { + if (current_instance.is_null()) { WARN_PRINT("Recording should not be set as active before Godot has initialized."); return; } ensure_thread_stopped(); current_instance->init(); } else { - if (current_instance != nullptr) { + if (current_instance.is_valid()) { current_instance->is_recording = false; } } } bool AudioEffectRecord::is_recording_active() const { - if (current_instance == nullptr) { + if (current_instance.is_null()) { return false; } else { return current_instance->is_recording; diff --git a/servers/xr_server.cpp b/servers/xr_server.cpp index a4e68afee0..4c4781fdef 100644 --- a/servers/xr_server.cpp +++ b/servers/xr_server.cpp @@ -183,7 +183,7 @@ Transform3D XRServer::get_reference_frame() const { } void XRServer::center_on_hmd(RotationMode p_rotation_mode, bool p_keep_height) { - if (primary_interface == nullptr) { + if (primary_interface.is_null()) { return; } @@ -235,7 +235,7 @@ void XRServer::_set_render_reference_frame(const Transform3D &p_reference_frame) Transform3D XRServer::get_hmd_transform() { Transform3D hmd_transform; - if (primary_interface != nullptr) { + if (primary_interface.is_valid()) { hmd_transform = primary_interface->get_camera_transform(); } return hmd_transform; |