summaryrefslogtreecommitdiff
path: root/core/pim
authorzecke <zecke>2002-06-19 17:38:11 (UTC)
committer zecke <zecke>2002-06-19 17:38:11 (UTC)
commit23ac56db3aa77b298f20b288aadf503fd09a23a9 (patch) (unidiff)
treefe820ec743bbf829d31ae3ab1436a41a69b1855c /core/pim
parentdee5f6c5a3bd982913d0b234fb9392ce68d5df63 (diff)
downloadopie-23ac56db3aa77b298f20b288aadf503fd09a23a9.zip
opie-23ac56db3aa77b298f20b288aadf503fd09a23a9.tar.gz
opie-23ac56db3aa77b298f20b288aadf503fd09a23a9.tar.bz2
Tille ask Diana how she was able to trigger that bug?
I nominate her for the bug finding queen 2002. Ok I just fixed two possible crashes with the risk of losing data.
Diffstat (limited to 'core/pim') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/addressbook/abtable.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp
index e9e6a0b..3fa1a7c 100644
--- a/core/pim/addressbook/abtable.cpp
+++ b/core/pim/addressbook/abtable.cpp
@@ -562,6 +562,8 @@ void AbTable::loadFile( const QString &strFile, bool journalFile )
562 list.setAutoDelete( TRUE ); 562 list.setAutoDelete( TRUE );
563 QByteArray ba = f.readAll(); 563 QByteArray ba = f.readAll();
564 f.close(); 564 f.close();
565 if (ba.isEmpty() )
566 return;
565 char *uc = ba.data();//(QChar *)data.unicode(); 567 char *uc = ba.data();//(QChar *)data.unicode();
566 int len = ba.size();//data.length(); 568 int len = ba.size();//data.length();
567 bool foundAction = false; 569 bool foundAction = false;
@@ -797,17 +799,24 @@ void AbTable::journalFreeReplace( const Contact &cnt, int row )
797{ 799{
798 QString strName, 800 QString strName,
799 strContact; 801 strContact;
800 AbTableItem *ati; 802 AbTableItem *ati = 0l;
801 803
802 strName = findContactName( cnt ); 804 strName = findContactName( cnt );
803 strContact = findContactContact( cnt ); 805 strContact = findContactContact( cnt );
804 ati = static_cast<AbTableItem*>(item(row, 0)); 806 ati = static_cast<AbTableItem*>(item(row, 0));
807 if ( ati != 0 ) {
805 contactList.remove( ati ); 808 contactList.remove( ati );
806 ati->setItem( strName, strContact ); 809 ati->setItem( strName, strContact );
807 contactList.insert( ati, cnt ); 810 contactList.insert( ati, cnt );
808 811
809 ati = static_cast<AbTableItem*>(item(row, 1)); 812 ati = static_cast<AbTableItem*>(item(row, 1));
810 ati->setItem( strContact, strName ); 813 ati->setItem( strContact, strName );
814 }else{
815 int myrows = numRows();
816 setNumRows( myrows + 1 );
817 insertIntoTable( cnt, myrows );
818 // gets deleted when returning
819 }
811} 820}
812 821
813void AbTable::journalFreeRemove( int row ) 822void AbTable::journalFreeRemove( int row )