Better error message when missing root path.
Test: verified with and without error condition
Bug: 32764715
Change-Id: I9fda440c3d2f435f20fb81f1f2abbcda28d860c5
diff --git a/main.cpp b/main.cpp
index b85df57..29de12c 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1207,7 +1207,12 @@
packageRoots.push_back("android.hardware");
const char *TOP = getenv("TOP");
- CHECK(TOP != NULL);
+ if (TOP == nullptr) {
+ fprintf(stderr,
+ "ERROR: No root path (-r) specified"
+ " and $TOP environment variable not set.\n");
+ exit(1);
+ }
std::string path = TOP;
path.append("/hardware/interfaces");