Skip to content

Commit

Permalink
Fix case where VR::is_hmd_active could crash with null runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Jan 2, 2024
1 parent 4f9f362 commit 81102ec
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/mods/VR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,17 @@ class VR : public Mod {
}

bool is_hmd_active() const {
return !m_disable_vr && (get_runtime()->ready() || (m_stereo_emulation_mode && get_runtime()->loaded));
if (m_disable_vr) {
return false;
}

auto runtime = get_runtime();

if (runtime == nullptr) {
return false;
}

return runtime->ready() || (m_stereo_emulation_mode && runtime->loaded);
}

auto get_hmd() const {
Expand Down

0 comments on commit 81102ec

Please sign in to comment.