diff --git a/folderstorage.cpp b/folderstorage.cpp index be9703b3c..939750c12 100644 --- a/folderstorage.cpp +++ b/folderstorage.cpp @@ -470,8 +470,11 @@ void FolderStorage::take(QPtrList msgList) //----------------------------------------------------------------------------- KMMessage* FolderStorage::getMsg(int idx) { - if ( idx < 0 || idx >= count() ) - { + if ( mOpenCount <= 0 ) { + kdWarning(5006) << "FolderStorage::getMsg was called on a closed folder: " << folder()->prettyURL() << endl; + return 0; + } + if ( idx < 0 || idx >= count() ) { kdWarning(5006) << "FolderStorage::getMsg was asked for an invalid index. idx =" << idx << " count()=" << count() << endl; return 0; }