odrefresh: clean error message if env var missing

Missing DEX2OATBOOTCLASSPATH and SYSTEMSERVERCLASSPATH environment
variables are non-recoverable, but fail with a clear error message.

Test: TH
Change-Id: I3c493eb75b62030c2b87f6a9a6215e9d0135caab
diff --git a/odrefresh/odrefresh.cc b/odrefresh/odrefresh.cc
index 2518b28..683cf73 100644
--- a/odrefresh/odrefresh.cc
+++ b/odrefresh/odrefresh.cc
@@ -140,6 +140,12 @@
   return ss.str();
 }
 
+static std::string GetEnvironmentVariableOrDie(const char* name) {
+  const char* value = getenv(name);
+  LOG_ALWAYS_FATAL_IF(value == nullptr, "%s is not defined.", name);
+  return value;
+}
+
 static std::string QuotePath(std::string_view path) {
   return Concatenate({"'", path, "'"});
 }
@@ -1356,8 +1362,8 @@
   static int InitializeTargetConfig(int argc, const char** argv, OdrConfig* config) {
     config->SetApexInfoListFile("/apex/apex-info-list.xml");
     config->SetArtBinDir(GetArtBinDir());
-    config->SetDex2oatBootclasspath(getenv("DEX2OATBOOTCLASSPATH"));
-    config->SetSystemServerClasspath(getenv("SYSTEMSERVERCLASSPATH"));
+    config->SetDex2oatBootclasspath(GetEnvironmentVariableOrDie("DEX2OATBOOTCLASSPATH"));
+    config->SetSystemServerClasspath(GetEnvironmentVariableOrDie("SYSTEMSERVERCLASSPATH"));
     config->SetIsa(kRuntimeISA);
 
     const std::string zygote = android::base::GetProperty("ro.zygote", {});