From 0e92714828ad5ffa8ab4b8e2ac7a18d284d79041 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 4 Dec 2014 10:49:05 -0600 Subject: Fix crash of type reported in TDECRSH-02c7aad-341394a-38a161d-3c0c32e-b7216be-e399e04-a0b51d0 --- tderesources/carddav/resource.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'tderesources') 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("") + i18n("Remote authorization required") + TQString("

") + 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("") + i18n("Remote authorization required") + TQString("

") + 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"); -- cgit v1.2.1