Premature return if message list/set is empty.
This commit is contained in:
parent
3fcea19d75
commit
642cdf42f6
@ -767,6 +767,9 @@ void IMAPFolder::fetchMessages(std::vector <shared_ptr <message> >& msg, const f
|
|||||||
else if (!isOpen())
|
else if (!isOpen())
|
||||||
throw exceptions::illegal_state("Folder not open");
|
throw exceptions::illegal_state("Folder not open");
|
||||||
|
|
||||||
|
if (msg.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
// Build message numbers list
|
// Build message numbers list
|
||||||
std::vector <int> list;
|
std::vector <int> list;
|
||||||
list.reserve(msg.size());
|
list.reserve(msg.size());
|
||||||
@ -870,6 +873,9 @@ std::vector <shared_ptr <message> > IMAPFolder::getAndFetchMessages
|
|||||||
else if (!isOpen())
|
else if (!isOpen())
|
||||||
throw exceptions::illegal_state("Folder not open");
|
throw exceptions::illegal_state("Folder not open");
|
||||||
|
|
||||||
|
if (msgs.isEmpty())
|
||||||
|
return std::vector <shared_ptr <message> >();
|
||||||
|
|
||||||
// Ensure we also get the UID for each message
|
// Ensure we also get the UID for each message
|
||||||
fetchAttributes attribsWithUID(attribs);
|
fetchAttributes attribsWithUID(attribs);
|
||||||
attribsWithUID.add(fetchAttributes::UID);
|
attribsWithUID.add(fetchAttributes::UID);
|
||||||
|
@ -1187,6 +1187,9 @@ void maildirFolder::fetchMessages(std::vector <shared_ptr <message> >& msg,
|
|||||||
else if (!isOpen())
|
else if (!isOpen())
|
||||||
throw exceptions::illegal_state("Folder not open");
|
throw exceptions::illegal_state("Folder not open");
|
||||||
|
|
||||||
|
if (msg.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
const size_t total = msg.size();
|
const size_t total = msg.size();
|
||||||
size_t current = 0;
|
size_t current = 0;
|
||||||
|
|
||||||
@ -1226,6 +1229,9 @@ void maildirFolder::fetchMessage(shared_ptr <message> msg, const fetchAttributes
|
|||||||
std::vector <shared_ptr <message> > maildirFolder::getAndFetchMessages
|
std::vector <shared_ptr <message> > maildirFolder::getAndFetchMessages
|
||||||
(const messageSet& msgs, const fetchAttributes& attribs)
|
(const messageSet& msgs, const fetchAttributes& attribs)
|
||||||
{
|
{
|
||||||
|
if (msgs.isEmpty())
|
||||||
|
return std::vector <shared_ptr <message> >();
|
||||||
|
|
||||||
std::vector <shared_ptr <message> > messages = getMessages(msgs);
|
std::vector <shared_ptr <message> > messages = getMessages(msgs);
|
||||||
fetchMessages(messages, attribs);
|
fetchMessages(messages, attribs);
|
||||||
|
|
||||||
|
@ -315,6 +315,9 @@ void POP3Folder::fetchMessages(std::vector <shared_ptr <message> >& msg, const f
|
|||||||
else if (!isOpen())
|
else if (!isOpen())
|
||||||
throw exceptions::illegal_state("Folder not open");
|
throw exceptions::illegal_state("Folder not open");
|
||||||
|
|
||||||
|
if (msg.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
const size_t total = msg.size();
|
const size_t total = msg.size();
|
||||||
size_t current = 0;
|
size_t current = 0;
|
||||||
|
|
||||||
@ -487,6 +490,9 @@ void POP3Folder::fetchMessage(shared_ptr <message> msg, const fetchAttributes& o
|
|||||||
std::vector <shared_ptr <message> > POP3Folder::getAndFetchMessages
|
std::vector <shared_ptr <message> > POP3Folder::getAndFetchMessages
|
||||||
(const messageSet& msgs, const fetchAttributes& attribs)
|
(const messageSet& msgs, const fetchAttributes& attribs)
|
||||||
{
|
{
|
||||||
|
if (msgs.isEmpty())
|
||||||
|
return std::vector <shared_ptr <message> >();
|
||||||
|
|
||||||
std::vector <shared_ptr <message> > messages = getMessages(msgs);
|
std::vector <shared_ptr <message> > messages = getMessages(msgs);
|
||||||
fetchMessages(messages, attribs);
|
fetchMessages(messages, attribs);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user