Added code for checking NULL value when searching layout index 73/80373/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Sun, 17 Jul 2016 14:03:48 +0000 (23:03 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Sun, 17 Jul 2016 14:03:48 +0000 (23:03 +0900)
Change-Id: I4c0e64f4488de914d6309f353e33335fc7008e12

xmlresource/layout_parser.cpp

index 0a5edde..c78afdb 100644 (file)
@@ -348,12 +348,14 @@ LayoutParserImpl::release_key_strings() {
 
 int
 LayoutParserImpl::get_layout_index(const char *name) {
-    string strName = (string)name;
-    vector<string>::iterator it;
-    // make sure that the m_file_names are sorted.
-    it = lower_bound(m_file_names.begin(), m_file_names.end(), strName);
-    if (it != m_file_names.end() && *it == strName) {
-        return it-m_file_names.begin();
+    if (name) {
+        string strName = (string)name;
+        vector<string>::iterator it;
+        // make sure that the m_file_names are sorted.
+        it = lower_bound(m_file_names.begin(), m_file_names.end(), strName);
+        if (it != m_file_names.end() && *it == strName) {
+            return it - m_file_names.begin();
+        }
     }
     return NOT_USED;
 }