Resolved error when IMAP server returns an empty result

When the IMAP server returns an empty set of UIDs (no more data to read)
gmsearch_messages will throw error: UID command error:
BAD ['Could not parse command']. Resolved problem by checking for empty UID