In the previous implementation, the preference does not write the data
if the string value is empty string. Even if the data length is 0, the
function should return the empty string.
This patch is for backward compatibility.
Change-Id: I36c9892cda0530fc3a2170e73c685958d188232b
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
Data::Type data_type = static_cast<Data::Type>(type);
if (data_type == Data::Type::STRING) {
- if (index == raw_data_.size())
- return nullptr;
-
- if (raw_data_[raw_data_.size() - 1] != '\0') {
- _W("Last character is not a null-terminated string");
+ if (index == raw_data_.size() || raw_data_[raw_data_.size() - 1] != '\0')
raw_data_.push_back(0x00);
- }
const char* str = reinterpret_cast<const char*>(&raw_data_[index]);
data->SetString(str);