LegacySupport: fix compile error for some devices am: c40b6510cb
am: 3940f54aec
Change-Id: I1f58943c75de2dc0c66a3eca24bfa66a083a96b9
diff --git a/transport/include/hidl/LegacySupport.h b/transport/include/hidl/LegacySupport.h
index 0f37ae0..7cb72a9 100644
--- a/transport/include/hidl/LegacySupport.h
+++ b/transport/include/hidl/LegacySupport.h
@@ -42,9 +42,10 @@
LOG_FATAL_IF(service->isRemote(), "Implementation of %s/%s is remote!",
Interface::descriptor, name.c_str());
- LOG_FATAL_IF(ExpectInterface::castFrom(service) == nullptr,
- "Implementation of %s/%s is not a %s!", Interface::descriptor, name.c_str(),
- ExpectInterface::descriptor);
+
+ sp<ExpectInterface> expected = ExpectInterface::castFrom(service);
+ LOG_FATAL_IF(expected == nullptr, "Implementation of %s/%s is not a %s!", Interface::descriptor,
+ name.c_str(), ExpectInterface::descriptor);
status_t status = registerServiceCb(service, name);