diff options
author | Max Hilbrunner <mhilbrunner@users.noreply.github.com> | 2022-10-28 03:32:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-28 03:32:59 +0200 |
commit | 9ff3a43a329182ba2fad34263297052c70a4524e (patch) | |
tree | a2815c239af2b4f28611eb6055adf5fa92762c6b /platform/linuxbsd | |
parent | 6a61d22ce7373cdc45a0f2eae84d5742a3c9be73 (diff) | |
parent | e7091d07cdd15f9ef3c0083a02532efa2866298c (diff) |
Merge pull request #67957 from zCubed3/fix_headless_crash
Fix `OS.get_video_adapter_driver_info` crash on headless godot
Diffstat (limited to 'platform/linuxbsd')
-rw-r--r-- | platform/linuxbsd/os_linuxbsd.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp index 995a904398..11b667fcef 100644 --- a/platform/linuxbsd/os_linuxbsd.cpp +++ b/platform/linuxbsd/os_linuxbsd.cpp @@ -246,6 +246,10 @@ String OS_LinuxBSD::get_version() const { } Vector<String> OS_LinuxBSD::get_video_adapter_driver_info() const { + if (RenderingServer::get_singleton()->get_rendering_device() == nullptr) { + return Vector<String>(); + } + const String rendering_device_name = RenderingServer::get_singleton()->get_rendering_device()->get_device_name(); // e.g. `NVIDIA GeForce GTX 970` const String rendering_device_vendor = RenderingServer::get_singleton()->get_rendering_device()->get_device_vendor_name(); // e.g. `NVIDIA` const String card_name = rendering_device_name.trim_prefix(rendering_device_vendor).strip_edges(); // -> `GeForce GTX 970` |