Index: kmailicalifaceimpl.cpp
===================================================================
--- kmailicalifaceimpl.cpp	(wersja 809621)
+++ kmailicalifaceimpl.cpp	(kopia robocza)
@@ -1296,7 +1296,7 @@
 // Find message matching a given serial number
 KMMessage *KMailICalIfaceImpl::findMessageBySerNum( quint32 serNum, KMFolder* folder )
 {
-  if( !folder ) return 0;
+  if( !folder || serNum == 0 ) return 0;
 
   KMMessage *message = 0;
   KMFolder* aFolder = 0;
Index: kmacctcachedimap.cpp
===================================================================
--- kmacctcachedimap.cpp	(wersja 809621)
+++ kmacctcachedimap.cpp	(kopia robocza)
@@ -127,7 +127,7 @@
     if ((*it).parent)
       folderList << static_cast<KMFolderCachedImap*>((*it).parent->storage());
     // Kill the job - except if it's the one that already died and is calling us
-    if ( !it.key()->error() && mSlave ) {
+    if ( mSlave && !it.key()->error() ) {
       it.key()->kill();
       mSlave = 0; // killing a job, kills the slave
     }
