registerAsService fails gracefully.
Detect if defaultServiceManager is non existant and return appropriate
error.
Test: compiles
Change-Id: I044fa5f74ab278b9996ad0d03505712b84a82526
diff --git a/transport/include/hidl/HidlBinderSupport.h b/transport/include/hidl/HidlBinderSupport.h
index 8c2cd61..f906ea4 100644
--- a/transport/include/hidl/HidlBinderSupport.h
+++ b/transport/include/hidl/HidlBinderSupport.h
@@ -385,6 +385,9 @@
using ::android::hardware::defaultServiceManager; \
using ::android::hidl::manager::V1_0::IServiceManager; \
const sp<IServiceManager> sm = defaultServiceManager(); \
+ if (sm == nullptr) { \
+ return ::android::INVALID_OPERATION; \
+ } \
bool success = false; \
::android::hardware::Return<void> ret = \
this->interfaceChain( \