From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.204.141.209 with SMTP id n17cs186925bku; Thu, 8 Jul 2010 08:32:29 -0700 (PDT) Received: by 10.224.60.211 with SMTP id q19mr4697552qah.87.1278603148663; Thu, 08 Jul 2010 08:32:28 -0700 (PDT) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id u36si10287581qco.180.2010.07.08.08.32.27; Thu, 08 Jul 2010 08:32:28 -0700 (PDT) Received-SPF: pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-devel-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-devel-bounces@rubyforge.org Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id AA8271858379 for ; Thu, 8 Jul 2010 11:32:27 -0400 (EDT) Received: from smtp.chost.de (setoy.chost.de [217.160.209.225]) by rubyforge.org (Postfix) with ESMTP id F11CD1858379 for ; Thu, 8 Jul 2010 11:26:56 -0400 (EDT) Received: (qmail 19053 invoked by uid 5015); 8 Jul 2010 15:27:03 -0000 Received: (nullmailer pid 15262 invoked by uid 123); Thu, 08 Jul 2010 15:26:48 -0000 Received: from xo15-sascha.sascha.silbe.org (xo15-sascha.sascha.silbe.org [192.168.1.223]) by flatty.sascha.silbe.org ([192.168.1.252]) with SMTP via TCP; 08 Jul 2010 15:26:48 -0000 Received: (nullmailer pid 2590 invoked by uid 8193); Thu, 08 Jul 2010 15:26:46 -0000 From: Sascha Silbe To: sup-devel Date: Thu, 8 Jul 2010 15:26:37 +0000 Message-Id: <1278602797-2553-1-git-send-email-sascha-pgp@silbe.org> X-Mailer: git-send-email 1.7.1 Mail-Followup-To: Subject: [sup-devel] [PATCH] fix crash during poll if Maildir has been emptied X-BeenThere: sup-devel@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Sascha Silbe , Sup developer discussion List-Id: Sup developer discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-devel-bounces@rubyforge.org Errors-To: sup-devel-bounces@rubyforge.org We need to do the rescan in start_offset instead of end_offset so that end_offset won't be called if the Maildir is empty after the rescan. Fixes this crash: NoMethodError from thread: user-invoked poll undefined method `+' for nil:NilClass /home/sascha.silbe/src/sup/lib/sup/maildir.rb:171:in `end_offset' /home/sascha.silbe/src/sup/lib/sup/source.rb:90:in `done?' [...] Signed-off-by: Sascha Silbe --- lib/sup/maildir.rb | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sup/maildir.rb b/lib/sup/maildir.rb index ef3b318..0b2fd5e 100644 --- a/lib/sup/maildir.rb +++ b/lib/sup/maildir.rb @@ -162,12 +162,12 @@ class Maildir < Source end def start_offset - scan_mailbox + scan_mailbox :rescan => true @ids.first end def end_offset - scan_mailbox :rescan => true + scan_mailbox @ids.last + 1 end -- 1.7.1 _______________________________________________ Sup-devel mailing list Sup-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-devel