static_cast<std::shared_ptr<ThemeInfoLoader>*>(handle);
auto theme_info = (*p)->LoadCurrent();
+ if (!theme_info) {
+ LOG(ERROR) << "Failed to load current theme";
+ return THEME_MANAGER_ERROR_IO_ERROR;
+ }
*cur_theme = static_cast<theme_h>(new std::shared_ptr<ThemeInfo>(theme_info));
return THEME_MANAGER_ERROR_NONE;
}
= static_cast<std::shared_ptr<ThemeInfoLoader>*>(handle);
auto theme_info = (*p)->Load(id);
+ if (!theme_info) {
+ LOG(ERROR) << "Failed to load theme " << id;
+ return THEME_MANAGER_ERROR_IO_ERROR;
+ }
*theme = static_cast<theme_h>(new std::shared_ptr<ThemeInfo>(theme_info));
return THEME_MANAGER_ERROR_NONE;
}
std::shared_ptr<ThemeInfoLoader>* p =
static_cast<std::shared_ptr<ThemeInfoLoader>*>(handle);
std::string result = (*p)->AddEvent(std::move(event_handler));
+ if (result.empty()) {
+ LOG(ERROR) << "Failed to add theme event";
+ return THEME_MANAGER_ERROR_IO_ERROR;
+ }
*event_id = strdup(result.c_str());
if (*event_id == nullptr) {
LOG(ERROR) << "Out of memory";
* @retval #THEME_MANAGER_ERROR_NONE Successful
* @retval #THEME_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #THEME_MANAGER_OUT_OF_MEMORY Out of memory
+ * @retval #THEME_MANAGER_ERROR_IO_ERROR I/O error
* @see theme_loader_remove_event()
*/
int theme_loader_add_event(theme_loader_h handle,
* otherwise a negative error value
* @retval #THEME_MANAGER_ERROR_NONE Successful
* @retval #THEME_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #THEME_MANAGER_ERROR_IO_ERROR I/O error
*/
int theme_loader_load_current(theme_loader_h handle, theme_h *cur_theme);
* otherwise a negative error value
* @retval #THEME_MANAGER_ERROR_NONE Successful
* @retval #THEME_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #THEME_MANAGER_ERROR_IO_ERROR I/O error
*/
int theme_loader_load(theme_loader_h handle, const char *id, theme_h *theme);
}
return ErrorResultBundle();
}
+
+ GDBusMessageType type = g_dbus_message_get_message_type(reply);
+ if (type != G_DBUS_MESSAGE_TYPE_METHOD_RETURN) {
+ LOG(ERROR) << "Invalid reply message type: " << type;
+ if (type == G_DBUS_MESSAGE_TYPE_ERROR) {
+ if (g_dbus_message_to_gerror(reply, &err)) {
+ LOG(ERROR) << "error[" << err->message << "]";
+ g_error_free(err);
+ }
+ }
+ return ErrorResultBundle();
+ }
GVariant* reply_body = g_dbus_message_get_body(reply);
if (reply_body == nullptr) {
LOG(ERROR) << "g_dbus_message_get_body() is failed";
char* serialized = nullptr;
g_variant_get(reply_body, "(&s)", &serialized);
+ if (!serialized) {
+ LOG(ERROR) << "Failed to get reply data";
+ return ErrorResultBundle();
+ }
tizen_base::Bundle result(serialized);
return result;
}
tizen_base::Bundle reply =
dbus::RequestBroker::GetInst().SendData(dbus::Command::GET, b);
std::string str = reply.GetString(dbus::kCmdDataKey);
+ if (str.empty()) {
+ LOG(ERROR) << "Failed to load current theme info. Reply is empty";
+ return nullptr;
+ }
tizen_base::Bundle serialized(str);
if (serialized.IsEmpty()) {
- LOG(ERROR) << "Failed to load current theme info";
+ LOG(ERROR) << "Failed to load current theme info. "
+ << "Invalid bundle from reply";
return nullptr;
}