Merge "Check the fd handle before attempting to use it in GNSS HAL"
diff --git a/gnss/common/utils/default/include/v2_1/GnssTemplate.h b/gnss/common/utils/default/include/v2_1/GnssTemplate.h
index 7c3c58a..cbf3933 100644
--- a/gnss/common/utils/default/include/v2_1/GnssTemplate.h
+++ b/gnss/common/utils/default/include/v2_1/GnssTemplate.h
@@ -689,6 +689,10 @@
template <class T_IGnss>
Return<void> GnssTemplate<T_IGnss>::debug(const hidl_handle& fd,
const hidl_vec<hidl_string>& options) {
+ if (fd == nullptr || fd->numFds == 0) {
+ return Void();
+ }
+
if (options.size() == 0) {
return help(fd);
} else if (options[0] == "location") {