While creating tizen_base::Bundle() with the content info that is a
string, the constructor throws an exception. Because, it's not an encoded bundle raw.
This patch adds an encoding step and exception handlings to prevent crash issues.
Change-Id: I58d7eacafde020496ed087d770cffd953b26f7e3
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
return WIDGET_ERROR_FAULT;
}
return WIDGET_ERROR_FAULT;
}
+ try {
+ auto contents_raw = const_cast<tizen_base::Bundle&>(contents).ToRaw();
+ impl_->content_ = std::string(
+ reinterpret_cast<char*>(contents_raw.first.get()));
+ } catch (const std::bad_alloc& e) {
+ impl_->content_ = "";
+ _E("Exception(%s) occurs", e.what());
+ }
+
return WIDGET_ERROR_NONE;
}
return WIDGET_ERROR_NONE;
}
reason = DestroyType::PERMANENT;
}
reason = DestroyType::PERMANENT;
}
- tizen_base::Bundle content_info = impl_->content_.empty() ?
- tizen_base::Bundle() : tizen_base::Bundle(impl_->content_);
+ tizen_base::Bundle content_info;
+ try {
+ if (!impl_->content_.empty())
+ content_info = tizen_base::Bundle(impl_->content_);
+ } catch (const std::bad_alloc& e) {
+ _E("Exception(%s) occurs", e.what());
+ }
OnDestroy(reason, content_info);
OnDestroy(reason, content_info);