summaryrefslogtreecommitdiff
authorzecke <zecke>2004-10-20 16:53:01 (UTC)
committer zecke <zecke>2004-10-20 16:53:01 (UTC)
commit4f9e547592286caa541042454cf7815aa42f2e11 (patch) (unidiff)
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
@@ -571,65 +571,65 @@ bool OPimContactAccessBackend_XML::load( const QString filename, bool isJournal
571 dict.insert( "BusinessZip", new int(Qtopia::BusinessZip) ); 571 dict.insert( "BusinessZip", new int(Qtopia::BusinessZip) );
572 dict.insert( "BusinessCountry", new int(Qtopia::BusinessCountry) ); 572 dict.insert( "BusinessCountry", new int(Qtopia::BusinessCountry) );
573 dict.insert( "BusinessWebPage", new int(Qtopia::BusinessWebPage) ); 573 dict.insert( "BusinessWebPage", new int(Qtopia::BusinessWebPage) );
574 dict.insert( "JobTitle", new int(Qtopia::JobTitle) ); 574 dict.insert( "JobTitle", new int(Qtopia::JobTitle) );
575 dict.insert( "Department", new int(Qtopia::Department) ); 575 dict.insert( "Department", new int(Qtopia::Department) );
576 dict.insert( "Office", new int(Qtopia::Office) ); 576 dict.insert( "Office", new int(Qtopia::Office) );
577 dict.insert( "BusinessPhone", new int(Qtopia::BusinessPhone) ); 577 dict.insert( "BusinessPhone", new int(Qtopia::BusinessPhone) );
578 dict.insert( "BusinessFax", new int(Qtopia::BusinessFax) ); 578 dict.insert( "BusinessFax", new int(Qtopia::BusinessFax) );
579 dict.insert( "BusinessMobile", new int(Qtopia::BusinessMobile) ); 579 dict.insert( "BusinessMobile", new int(Qtopia::BusinessMobile) );
580 dict.insert( "BusinessPager", new int(Qtopia::BusinessPager) ); 580 dict.insert( "BusinessPager", new int(Qtopia::BusinessPager) );
581 dict.insert( "Profession", new int(Qtopia::Profession) ); 581 dict.insert( "Profession", new int(Qtopia::Profession) );
582 dict.insert( "Assistant", new int(Qtopia::Assistant) ); 582 dict.insert( "Assistant", new int(Qtopia::Assistant) );
583 dict.insert( "Manager", new int(Qtopia::Manager) ); 583 dict.insert( "Manager", new int(Qtopia::Manager) );
584 dict.insert( "Spouse", new int(Qtopia::Spouse) ); 584 dict.insert( "Spouse", new int(Qtopia::Spouse) );
585 dict.insert( "Children", new int(Qtopia::Children) ); 585 dict.insert( "Children", new int(Qtopia::Children) );
586 dict.insert( "Gender", new int(Qtopia::Gender) ); 586 dict.insert( "Gender", new int(Qtopia::Gender) );
587 dict.insert( "Birthday", new int(Qtopia::Birthday) ); 587 dict.insert( "Birthday", new int(Qtopia::Birthday) );
588 dict.insert( "Anniversary", new int(Qtopia::Anniversary) ); 588 dict.insert( "Anniversary", new int(Qtopia::Anniversary) );
589 dict.insert( "Nickname", new int(Qtopia::Nickname) ); 589 dict.insert( "Nickname", new int(Qtopia::Nickname) );
590 dict.insert( "Notes", new int(Qtopia::Notes) ); 590 dict.insert( "Notes", new int(Qtopia::Notes) );
591 dict.insert( "action", new int(JOURNALACTION) ); 591 dict.insert( "action", new int(JOURNALACTION) );
592 dict.insert( "actionrow", new int(JOURNALROW) ); 592 dict.insert( "actionrow", new int(JOURNALROW) );
593 593
594 //owarn << "OPimContactDefaultBackEnd::loading " << filename << "" << oendl; 594 //owarn << "OPimContactDefaultBackEnd::loading " << filename << "" << oendl;
595 595
596 XMLElement *root = XMLElement::load( filename ); 596 XMLElement *root = XMLElement::load( filename );
597 if(root != 0l ){ // start parsing 597 if(root != 0l ){ // start parsing
598 /* Parse all XML-Elements and put the data into the 598 /* Parse all XML-Elements and put the data into the
599 * Contact-Class 599 * Contact-Class
600 */ 600 */
601 XMLElement *element = root->firstChild(); 601 XMLElement *element = root->firstChild();
602 //owarn << "OPimContactAccess::load tagName(): " << root->tagName() << "" << oendl; 602 //owarn << "OPimContactAccess::load tagName(): " << root->tagName() << "" << oendl;
603 element = element->firstChild(); 603 element = element ? element->firstChild() : 0;
604 604
605 /* Search Tag "Contacts" which is the parent of all Contacts */ 605 /* Search Tag "Contacts" which is the parent of all Contacts */
606 while( element && !isJournal ){ 606 while( element && !isJournal ){
607 if( element->tagName() != QString::fromLatin1("Contacts") ){ 607 if( element->tagName() != QString::fromLatin1("Contacts") ){
608 //owarn << "OPimContactDefBack::Searching for Tag \"Contacts\"! Found: " 608 //owarn << "OPimContactDefBack::Searching for Tag \"Contacts\"! Found: "
609 // << element->tagName() << oendl; 609 // << element->tagName() << oendl;
610 element = element->nextChild(); 610 element = element->nextChild();
611 } else { 611 } else {
612 element = element->firstChild(); 612 element = element->firstChild();
613 break; 613 break;
614 } 614 }
615 } 615 }
616 /* Parse all Contacts and ignore unknown tags */ 616 /* Parse all Contacts and ignore unknown tags */
617 while( element ){ 617 while( element ){
618 if( element->tagName() != QString::fromLatin1("Contact") ){ 618 if( element->tagName() != QString::fromLatin1("Contact") ){
619 //owarn << "OPimContactDefBack::Searching for Tag \"Contact\"! Found: " 619 //owarn << "OPimContactDefBack::Searching for Tag \"Contact\"! Found: "
620 // << element->tagName() << oendl; 620 // << element->tagName() << oendl;
621 element = element->nextChild(); 621 element = element->nextChild();
622 continue; 622 continue;
623 } 623 }
624 /* Found alement with tagname "contact", now parse and store all 624 /* Found alement with tagname "contact", now parse and store all
625 * attributes contained 625 * attributes contained
626 */ 626 */
627 //owarn << "OPimContactDefBack::load element tagName() : " 627 //owarn << "OPimContactDefBack::load element tagName() : "
628 // << element->tagName() << oendl; 628 // << element->tagName() << oendl;
629 QString dummy; 629 QString dummy;
630 foundAction = false; 630 foundAction = false;
631 631
632 XMLElement::AttributeMap aMap = element->attributes(); 632 XMLElement::AttributeMap aMap = element->attributes();
633 XMLElement::AttributeMap::Iterator it; 633 XMLElement::AttributeMap::Iterator it;
634 contactMap.clear(); 634 contactMap.clear();
635 customMap.clear(); 635 customMap.clear();