diff --git a/src/dawn_node/binding/GPU.cpp b/src/dawn_node/binding/GPU.cpp index c4ba2a328b..cf22465ec3 100644 --- a/src/dawn_node/binding/GPU.cpp +++ b/src/dawn_node/binding/GPU.cpp @@ -31,7 +31,10 @@ namespace { } return ""; #else - return std::getenv(varName); + if (auto* val = std::getenv(varName)) { + return val; + } + return ""; #endif } } // namespace @@ -81,7 +84,8 @@ namespace wgpu { namespace binding { // Check for override from env var std::string envVar = getEnvVar("DAWNNODE_BACKEND"); - std::transform(envVar.begin(), envVar.end(), envVar.begin(), std::tolower); + std::transform(envVar.begin(), envVar.end(), envVar.begin(), + [](char c) { return std::tolower(c); }); if (envVar == "null") { targetBackendType = wgpu::BackendType::Null; } else if (envVar == "webgpu") {