mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 13:20:54 +00:00
Fix crashes when $HOME is not set
In case HOME environment variable hasn't been set, getenv returns NULL, which leads to a crash.
This commit is contained in:
committed by
Baldur Karlsson
parent
2967851360
commit
f2e68f1d31
@@ -301,7 +301,8 @@ string LayerRegistrationPath(LayerPath path)
|
||||
if(xdg && FileIO::exists(xdg))
|
||||
return string(xdg) + "/vulkan/implicit_layer.d/renderdoc_capture.json";
|
||||
|
||||
return string(getenv("HOME")) +
|
||||
const char *home_path = getenv("HOME");
|
||||
return string(home_path != NULL ? home_path : "") +
|
||||
"/.local/share/vulkan/implicit_layer.d/renderdoc_capture.json";
|
||||
}
|
||||
default: break;
|
||||
@@ -330,7 +331,10 @@ bool VulkanReplay::CheckVulkanLayer(VulkanLayerFlags &flags, std::vector<std::st
|
||||
{
|
||||
// see if the user has suppressed all this checking as a "I know what I'm doing" measure
|
||||
|
||||
if(FileExists(string(getenv("HOME")) + "/.renderdoc/ignore_vulkan_layer_issues"))
|
||||
const char *home_path = getenv("HOME");
|
||||
if(home_path == NULL)
|
||||
home_path = "";
|
||||
if(FileExists(string(home_path) + "/.renderdoc/ignore_vulkan_layer_issues"))
|
||||
{
|
||||
flags = VulkanLayerFlags::ThisInstallRegistered;
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user