diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2014-12-04 10:49:05 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2014-12-04 10:49:05 -0600 |
commit | 0e92714828ad5ffa8ab4b8e2ac7a18d284d79041 (patch) | |
tree | 2ebfe129fd466e377381aca933f9b890f6d91ecc /tderesources/carddav | |
parent | eed9975daadbc2435a94f908d7e732064b829368 (diff) | |
download | tdepim-0e92714828ad5ffa8ab4b8e2ac7a18d284d79041.tar.gz tdepim-0e92714828ad5ffa8ab4b8e2ac7a18d284d79041.zip |
Fix crash of type reported in
TDECRSH-02c7aad-341394a-38a161d-3c0c32e-b7216be-e399e04-a0b51d0
Diffstat (limited to 'tderesources/carddav')
-rw-r--r-- | tderesources/carddav/resource.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/tderesources/carddav/resource.cpp b/tderesources/carddav/resource.cpp index 9fc54692e..2161e4afe 100644 --- a/tderesources/carddav/resource.cpp +++ b/tderesources/carddav/resource.cpp @@ -155,7 +155,9 @@ bool ResourceCardDav::load() { loadCache(); //enableChangeNotification(); clearChanges(); - addressBook()->emitAddressBookChanged(); + if (addressBook() != NULL) { + addressBook()->emitAddressBookChanged(); + } emit loadingFinished( this ); log("starting download job"); @@ -373,7 +375,7 @@ void ResourceCardDav::loadFinished() { TQCString newpass; if (KPasswordDialog::getPassword (newpass, TQString("<b>") + i18n("Remote authorization required") + TQString("</b><p>") + i18n("Please input the password for") + TQString(" ") + mPrefs->getusername(), NULL) != 1) { log("load error: " + loader->errorString() ); - addressBook()->error(TQString("[%1] ").arg(abs(loader->errorNumber())) + loader->errorString()); + if (addressBook() != NULL) addressBook()->error(TQString("[%1] ").arg(abs(loader->errorNumber())) + loader->errorString()); } else { // Set new password and try again @@ -383,12 +385,12 @@ void ResourceCardDav::loadFinished() { } else { log("load error: " + loader->errorString() ); - addressBook()->error(TQString("[%1] ").arg(abs(loader->errorNumber())) + loader->errorString()); + if (addressBook() != NULL) addressBook()->error(TQString("[%1] ").arg(abs(loader->errorNumber())) + loader->errorString()); } } else { log("load error: " + loader->errorString() ); - addressBook()->error(TQString("[%1] ").arg(abs(loader->errorNumber())) + loader->errorString()); + if (addressBook() != NULL) addressBook()->error(TQString("[%1] ").arg(abs(loader->errorNumber())) + loader->errorString()); } } else { log("successful load"); @@ -404,7 +406,7 @@ void ResourceCardDav::loadFinished() { log("clearing changes"); //enableChangeNotification(); clearChanges(); - addressBook()->emitAddressBookChanged(); + if (addressBook() != NULL) addressBook()->emitAddressBookChanged(); emit loadingFinished( this ); } } @@ -441,7 +443,7 @@ bool ResourceCardDav::parseData(const TQString& data) { // check if the data is OK // May be it's not efficient (parsing is done twice), but it should be safe if (!checkData(data)) { - addressBook()->error(i18n("Parsing calendar data failed.")); + if (addressBook() != NULL) addressBook()->error(i18n("Parsing calendar data failed.")); return false; } @@ -477,7 +479,7 @@ bool ResourceCardDav::parseData(const TQString& data) { sout << data << "\n"; fout.close(); } else { - addressBook()->error(i18n("can't open file")); + if (addressBook() != NULL) addressBook()->error(i18n("can't open file")); } #endif // KCARDDAV_DEBUG // end of debug code ---------------------------------------------------- @@ -561,7 +563,7 @@ void ResourceCardDav::writingQueuePop() { sout << "================== Deleted:\n" << t->deleted << "\n"; fout.close(); } else { - addressBook()->error(i18n("can't open file")); + if (addressBook() != NULL) addressBook()->error(i18n("can't open file")); } #endif // debug @@ -642,7 +644,7 @@ void ResourceCardDav::writingFinished() { TQCString newpass; if (KPasswordDialog::getPassword (newpass, TQString("<b>") + i18n("Remote authorization required") + TQString("</b><p>") + i18n("Please input the password for") + TQString(" ") + mPrefs->getusername(), NULL) != 1) { log("write error: " + mWriter->errorString()); - addressBook()->error(TQString("[%1] ").arg(abs(mWriter->errorNumber())) + mWriter->errorString()); + if (addressBook() != NULL) addressBook()->error(TQString("[%1] ").arg(abs(mWriter->errorNumber())) + mWriter->errorString()); } else { // Set new password and try again @@ -652,12 +654,12 @@ void ResourceCardDav::writingFinished() { } else { log("write error: " + mWriter->errorString()); - addressBook()->error(TQString("[%1] ").arg(abs(mWriter->errorNumber())) + mWriter->errorString()); + if (addressBook() != NULL) addressBook()->error(TQString("[%1] ").arg(abs(mWriter->errorNumber())) + mWriter->errorString()); } } else { log("write error: " + mWriter->errorString()); - addressBook()->error(TQString("[%1] ").arg(abs(mWriter->errorNumber())) + mWriter->errorString()); + if (addressBook() != NULL) addressBook()->error(TQString("[%1] ").arg(abs(mWriter->errorNumber())) + mWriter->errorString()); } } else { log("success"); |