bootstrap: fix a potentional null-dereferencing
[platform/core/uifw/aurum.git] / bootstrap / server / src / Commands / SetValueCommand.cc
1 #include "SetValueCommand.h"
2 #include <loguru.hpp>
3
4 SetValueCommand::SetValueCommand(const ::aurum::ReqSetValue* request,
5                                  ::aurum::RspSetValue*       response)
6     : mRequest{request}, mResponse{response}
7 {
8 }
9
10 ::grpc::Status SetValueCommand::execute()
11 {
12     LOG_SCOPE_F(INFO, "SetValue --------------- ");
13     ObjectMapper* mObjMap = ObjectMapper::getInstance();
14     UiObject*     obj = mObjMap->getElement(mRequest->elementid());
15     if (obj) obj->setText(const_cast<std::string&>(mRequest->stringvalue()));
16     LOG_F(INFO, "%p %s", obj, mRequest->stringvalue().c_str());
17     return grpc::Status::OK;
18 }