summarylogtreecommitdiffstats
path: root/swr-rast-do-not-crash-on-NULL-strings-returned-by-getenv.patch
diff options
context:
space:
mode:
Diffstat (limited to 'swr-rast-do-not-crash-on-NULL-strings-returned-by-getenv.patch')
-rw-r--r--swr-rast-do-not-crash-on-NULL-strings-returned-by-getenv.patch14
1 files changed, 14 insertions, 0 deletions
diff --git a/swr-rast-do-not-crash-on-NULL-strings-returned-by-getenv.patch b/swr-rast-do-not-crash-on-NULL-strings-returned-by-getenv.patch
new file mode 100644
index 000000000000..b9e81f9a32fe
--- /dev/null
+++ b/swr-rast-do-not-crash-on-NULL-strings-returned-by-getenv.patch
@@ -0,0 +1,14 @@
+diff --git a/src/gallium/drivers/swr/rasterizer/core/utils.h b/src/gallium/drivers/swr/rasterizer/core/utils.h
+index b096d2120cb..3c849e82d3b 100644
+--- a/src/gallium/drivers/swr/rasterizer/core/utils.h
++++ b/src/gallium/drivers/swr/rasterizer/core/utils.h
+@@ -365,7 +365,8 @@ static INLINE std::string GetEnv(const std::string& variableName)
+ output.resize(valueSize - 1); // valueSize includes null, output.resize() does not
+ GetEnvironmentVariableA(variableName.c_str(), &output[0], valueSize);
+ #else
+- output = getenv(variableName.c_str());
++ char *o = getenv(variableName.c_str());
++ output = o ? std::string(o) : std::string();
+ #endif
+
+ return output;