The routine to check the empty array must be performed first
Change-Id: I0013fae4c1e4e99ff7ac54881359de2cd68e663b
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
bool ThemeParser::ExtractArray(const Json::Value& node,
std::string parent_key, ThemeInfoBuilder* builder) {
+ if (node.empty()) {
+ LOG(ERROR) << "Empty array is not allowed";
+ return false;
+ }
+
Json::ValueType element_type = node.begin()->type();
std::vector<std::string> array_values;
int ind = 0;
element_type == Json::ValueType::objectValue)
return true;
- if (array_values.empty()) {
- LOG(ERROR) << "Empty array is not allowed";
- return false;
- }
-
builder->PutStringArray(parent_key, array_values);
return true;
}