summaryrefslogtreecommitdiff
authorzecke <zecke>2004-10-20 16:53:01 (UTC)
committer zecke <zecke>2004-10-20 16:53:01 (UTC)
commit4f9e547592286caa541042454cf7815aa42f2e11 (patch) (side-by-side diff)
tree3a6249fc0f92e005e6b8cd01ec41027da10bb56b
parent553864fc23dc7b0f7caab0394361174c25c9287c (diff)
downloadopie-4f9e547592286caa541042454cf7815aa42f2e11.zip
opie-4f9e547592286caa541042454cf7815aa42f2e11.tar.gz
opie-4f9e547592286caa541042454cf7815aa42f2e11.tar.bz2
- touch ~/Applications/addressbook/addressbook.xml lead to a Crash on XML
loading. Don't assume that the Child of the first element is present
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
index 00d62ee..18113c2 100644
--- a/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
+++ b/libopie2/opiepim/backend/ocontactaccessbackend_xml.cpp
@@ -579,49 +579,49 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal
dict.insert( "BusinessMobile", new int(Qtopia::BusinessMobile) );
dict.insert( "BusinessPager", new int(Qtopia::BusinessPager) );
dict.insert( "Profession", new int(Qtopia::Profession) );
dict.insert( "Assistant", new int(Qtopia::Assistant) );
dict.insert( "Manager", new int(Qtopia::Manager) );
dict.insert( "Spouse", new int(Qtopia::Spouse) );
dict.insert( "Children", new int(Qtopia::Children) );
dict.insert( "Gender", new int(Qtopia::Gender) );
dict.insert( "Birthday", new int(Qtopia::Birthday) );
dict.insert( "Anniversary", new int(Qtopia::Anniversary) );
dict.insert( "Nickname", new int(Qtopia::Nickname) );
dict.insert( "Notes", new int(Qtopia::Notes) );
dict.insert( "action", new int(JOURNALACTION) );
dict.insert( "actionrow", new int(JOURNALROW) );
//owarn << "OPimContactDefaultBackEnd::loading " << filename << "" << oendl;
XMLElement *root = XMLElement::load( filename );
if(root != 0l ){ // start parsing
/* Parse all XML-Elements and put the data into the
* Contact-Class
*/
XMLElement *element = root->firstChild();
//owarn << "OPimContactAccess::load tagName(): " << root->tagName() << "" << oendl;
- element = element->firstChild();
+ element = element ? element->firstChild() : 0;
/* Search Tag "Contacts" which is the parent of all Contacts */
while( element && !isJournal ){
if( element->tagName() != QString::fromLatin1("Contacts") ){
//owarn << "OPimContactDefBack::Searching for Tag \"Contacts\"! Found: "
// << element->tagName() << oendl;
element = element->nextChild();
} else {
element = element->firstChild();
break;
}
}
/* Parse all Contacts and ignore unknown tags */
while( element ){
if( element->tagName() != QString::fromLatin1("Contact") ){
//owarn << "OPimContactDefBack::Searching for Tag \"Contact\"! Found: "
// << element->tagName() << oendl;
element = element->nextChild();
continue;
}
/* Found alement with tagname "contact", now parse and store all
* attributes contained
*/
//owarn << "OPimContactDefBack::load element tagName() : "