diff options
author | Rajeswari N <rajin@codeaurora.org> | 2020-08-19 15:09:05 +0530 |
---|---|---|
committer | Mohit Sharma <smohit@codeaurora.org> | 2020-11-24 14:46:17 +0530 |
commit | 9f7448e7644b2d420814743d979c406458a5842a (patch) | |
tree | 47547f240a772afd2ae0ca96c321fe76c856b618 | |
parent | cff2a0a59b4da66e41413d65fe291399b9cbbf46 (diff) |
power: add check for shared pointer
Add check for shared pointer
Change-Id: I984988e49b3e59f3a674fb6dbfc8c19d3adb6d74
-rw-r--r-- | main.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -40,10 +40,12 @@ int main() { std::shared_ptr<Power> vib = ndk::SharedRefBase::make<Power>(); const std::string instance = std::string() + Power::descriptor + "/default"; LOG(INFO) << "Instance " << instance; - binder_status_t status = AServiceManager_addService(vib->asBinder().get(), instance.c_str()); - LOG(INFO) << "Status " << status; - if(status != STATUS_OK){ - LOG(ERROR) << "Could not register" << instance; + if(vib){ + binder_status_t status = AServiceManager_addService(vib->asBinder().get(), instance.c_str()); + LOG(INFO) << "Status " << status; + if(status != STATUS_OK){ + LOG(ERROR) << "Could not register" << instance; + } } ABinderProcess_joinThreadPool(); |