This variant of this function makes use of an optional return type, which makes code easier to read around it. Chromium change: https://chromium.googlesource.com/chromium/src/+/29d1bd26d171ea8d187ef62fb45519bad9551e08 commit 29d1bd26d171ea8d187ef62fb45519bad9551e08 Author: Lei Zhang <thestig@chromium.org> Date: Mon Mar 10 15:43:32 2025 -0700 Add modern version of base::Environment::GetVar() that returns optional Add a version of GetVar() that returns an optional, instead of writing the result to an out-parameter and returning a bool. Keep the existing GetVar() but add a comment to mention it is deprecated. Convert base/nix/xdg_util.cc and its unit test to use the new GetVar(). Bug: 400758498