while (cur_node != NULL) {
if (0 == xmlStrcmp(cur_node->name, (const xmlChar *)"file")) {
assert(m_size >= 0 && m_size < MAX_NINE_PATCH_FILE_LIST);
- m_nine_patch_file_list[m_size].image_path = (const char*)xmlNodeGetContent(cur_node);
- get_prop_number(cur_node, "left", &(m_nine_patch_file_list[m_size].left));
- get_prop_number(cur_node, "right", &(m_nine_patch_file_list[m_size].right));
- get_prop_number(cur_node, "top", &(m_nine_patch_file_list[m_size].top));
- get_prop_number(cur_node, "bottom", &(m_nine_patch_file_list[m_size].bottom));
- if (m_nine_patch_file_list[m_size].image_path == NULL) {
- SCLLOG(SclLog::ERROR, "NinePatchFileParser: image_path should be not NULL");
- }
- m_size++;
- if (m_size >= MAX_NINE_PATCH_FILE_LIST) {
- SCLLOG(SclLog::ERROR, "No Space for nine patch file list record.");
- break;
+ if (m_size >= 0 && m_size < MAX_NINE_PATCH_FILE_LIST) {
+ m_nine_patch_file_list[m_size].image_path = (const char*)xmlNodeGetContent(cur_node);
+ get_prop_number(cur_node, "left", &(m_nine_patch_file_list[m_size].left));
+ get_prop_number(cur_node, "right", &(m_nine_patch_file_list[m_size].right));
+ get_prop_number(cur_node, "top", &(m_nine_patch_file_list[m_size].top));
+ get_prop_number(cur_node, "bottom", &(m_nine_patch_file_list[m_size].bottom));
+ if (m_nine_patch_file_list[m_size].image_path == NULL) {
+ SCLLOG(SclLog::ERROR, "NinePatchFileParser: image_path should be not NULL");
+ }
+ m_size++;
+ if (m_size >= MAX_NINE_PATCH_FILE_LIST) {
+ SCLLOG(SclLog::ERROR, "No Space for nine patch file list record.");
+ break;
+ }
}
}