author | eilers <eilers> | 2002-12-27 13:03:34 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-12-27 13:03:34 (UTC) |
commit | 158fd475abbc652613d5eed362dae79f94b17803 (patch) (side-by-side diff) | |
tree | 60b38278a274ac97d0ebb1226cfd881418d735bf | |
parent | 8ae81608ed194e36236ea68c5fbed54ac6c0275c (diff) | |
download | opie-158fd475abbc652613d5eed362dae79f94b17803.zip opie-158fd475abbc652613d5eed362dae79f94b17803.tar.gz opie-158fd475abbc652613d5eed362dae79f94b17803.tar.bz2 |
Fixing nullpointer crash if "emails" selected
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 1b83308..b68d88c 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp @@ -646,66 +646,70 @@ void ContactEditor::init() { void ContactEditor::defaultEmailChanged(int i){ qDebug("defaultEmailChanged"); int index = cmbChooserField1->currentItem(); slChooserValues[index] = cmbDefaultEmail->text(i); } void ContactEditor::populateDefaultEmailCmb(){ cmbDefaultEmail->clear(); cmbDefaultEmail->insertStringList(emails); for ( int i = 0; i < cmbDefaultEmail->count(); i++){ qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<",cmbDefaultEmail->text( i ).latin1(),defaultEmail.latin1()); if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ cmbDefaultEmail->setCurrentItem( i ); qDebug("set"); } } } void ContactEditor::chooserChange( const QString &textChanged, int index, QLineEdit *inputWid, int widgetPos ) { QString type = slChooserNames[index]; qDebug("ContactEditor::chooserChange( type=>%s<, textChanged=>%s< index=%i, widgetPos=%i",type.latin1(),textChanged.latin1(), index, widgetPos ); if ( type == "Default Email"){ defaultEmail = textChanged; - if (cmbDefaultEmail) delete cmbDefaultEmail; + if (cmbDefaultEmail){ + delete cmbDefaultEmail; + cmbDefaultEmail = 0l; + } cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); cmbDefaultEmail->show(); populateDefaultEmailCmb(); connect(cmbDefaultEmail,SIGNAL(activated(int)), SLOT(defaultEmailChanged(int))); defaultEmailChooserPosition = widgetPos; }else if (defaultEmailChooserPosition == widgetPos){ qDebug("cmbDefaultEmail->hide()"); if (cmbDefaultEmail) cmbDefaultEmail->hide(); widgetPos=-1; }else if (type == "Emails"){ qDebug("emails"); QString de; emails = QStringList::split (",", textChanged ); - populateDefaultEmailCmb(); + if ( cmbDefaultEmail ) + populateDefaultEmailCmb(); } slChooserValues[index] = textChanged; } void ContactEditor::slotChooser1Change( const QString &textChanged ) { chooserChange( textChanged, cmbChooserField1->currentItem(), txtChooserField1, 1); } void ContactEditor::slotChooser2Change( const QString &textChanged ) { chooserChange( textChanged, cmbChooserField2->currentItem(), txtChooserField2, 2); } void ContactEditor::slotChooser3Change( const QString &textChanged ) { chooserChange( textChanged, cmbChooserField3->currentItem(), txtChooserField3, 3); } void ContactEditor::slotChooser4Change( const QString &textChanged ) { chooserChange( textChanged, cmbChooserField4->currentItem(), txtChooserField4, 4); } |