- Checks the result of bundle_get_byte()
Change-Id: I4572060adc7cf1e6eebb149fbc68a2974add92b2
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
std::vector<unsigned char> Bundle::GetByte(const std::string& key) const {
size_t size;
unsigned char* bytes = nullptr;
- bundle_get_byte(impl_->handle_, key.c_str(),
+ int ret = bundle_get_byte(impl_->handle_, key.c_str(),
reinterpret_cast<void**>(&bytes), &size);
+ if (ret != BUNDLE_ERROR_NONE) {
+ LOGE("bundle_get_byte() is failed");
+ return {};
+ }
+
return std::vector<unsigned char>(bytes, bytes + size);
}