Index: lib/sup/maildir.rb =================================================================== --- lib/sup/maildir.rb (revision 503) +++ lib/sup/maildir.rb (working copy) @@ -31,7 +31,7 @@ def check scan_mailbox - start = @ids.index(cur_offset || start_offset) or raise OutOfSyncSourceError, "Unknown message id #{cur_offset || start_offset}." # couldn't find the most recent email + start = @ids.index(cur_offset || start_offset) or raise OutOfSyncSourceError, "Unknown message id #{cur_offset || start_offset}." unless @ids.empty? # couldn't find the most recent email end def load_header id @@ -87,9 +87,7 @@ end def each - scan_mailbox - start = @ids.index(cur_offset || start_offset) or raise OutOfSyncSourceError, "Unknown message id #{cur_offset || start_offset}." # couldn't find the most recent email - + check start.upto(@ids.length - 1) do |i| id = @ids[i] self.cur_offset = id @@ -99,12 +97,12 @@ def start_offset scan_mailbox - @ids.first + @ids.first || 0 end def end_offset scan_mailbox - @ids.last + @ids.last || 0 end def pct_done; 100.0 * (@ids.index(cur_offset) || 0).to_f / (@ids.length - 1).to_f; end