aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Elliott <ian@LunarG.com>2015-02-20 14:12:18 -0700
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2015-03-02 17:21:09 -0700
commitf94f9bc3358d29b8cf7c03d753808bbbb61a5a3f (patch)
tree8d3d0970b5c4e064a6e75eca309de0426c816aee
parent50e3444dd5f5582e3a9666e037c0b8c8e5145ae9 (diff)
downloadusermoji-f94f9bc3358d29b8cf7c03d753808bbbb61a5a3f.tar.xz
xcb: Deal with case of getenv() returning NULL.
At least on Windows, getenv() returns NULL when the environment variable is not found. This causes a problem inside of "xcb_nvidia.cpp" when a C++ std::string is assigned the return value of getenv().
-rw-r--r--demos/xcb_nvidia.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/demos/xcb_nvidia.cpp b/demos/xcb_nvidia.cpp
index 5ecd0884..5a35d937 100644
--- a/demos/xcb_nvidia.cpp
+++ b/demos/xcb_nvidia.cpp
@@ -37,11 +37,11 @@ std::deque<XcbId> g_xcbIds;
xcb_connection_t * xcb_connect(const char *displayname, int *screenp)
{
- std::string xglNvidia = getenv(DRIVER_PATH_ENV);
+ std::string xglNvidia = (getenv(DRIVER_PATH_ENV) == NULL) ? "" : getenv(DRIVER_PATH_ENV);
xglNvidia += "\\xgl_nvidia.dll";
HMODULE module = LoadLibrary(xglNvidia.c_str());
if (!module) {
- std::string xglNulldrv = getenv("LIBXGL_DRIVERS_PATH");
+ std::string xglNulldrv = (getenv("XGL_DRIVERS_PATH") == NULL) ? "" : getenv("LIBXGL_DRIVERS_PATH");
xglNulldrv += "\\xgl_nulldrv.dll";
module = LoadLibrary(xglNulldrv.c_str());
}