From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.86.87.8 with SMTP id k8cs2968fgb; Tue, 9 Mar 2010 20:55:43 -0800 (PST) Received: by 10.224.109.213 with SMTP id k21mr662523qap.182.1268196942604; Tue, 09 Mar 2010 20:55:42 -0800 (PST) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id 5si18321193qwg.13.2010.03.09.20.55.42; Tue, 09 Mar 2010 20:55:42 -0800 (PST) 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 E700B1588078; Tue, 9 Mar 2010 23:55:41 -0500 (EST) X-Greylist: delayed 300 seconds by postgrey-1.31 at rubyforge.org; Tue, 09 Mar 2010 23:55:32 EST Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU [18.9.25.15]) by rubyforge.org (Postfix) with ESMTP id B214D18582D7 for ; Tue, 9 Mar 2010 23:55:32 -0500 (EST) X-AuditID: 1209190f-b7b9fae000000982-e1-4b972515f0f6 Received: from mailhub-4.mit.edu (MAILHUB-4.MIT.EDU [18.7.62.40]) by dmz-mailsec-scanner-4.mit.edu (Symantec Brightmail Gateway) with SMTP id F3.DD.02434.515279B4; Tue, 9 Mar 2010 23:50:29 -0500 (EST) Received: from outgoing-legacy.mit.edu (OUTGOING-LEGACY.MIT.EDU [18.7.22.104]) by mailhub-4.mit.edu (8.13.8/8.9.2) with ESMTP id o2A4oTEw011899 for ; Tue, 9 Mar 2010 23:50:29 -0500 Received: from localhost (EZYANG.MIT.EDU [18.243.1.50]) ) by outgoing-legacy.mit.edu (8.13.6/8.12.4) with ESMTP id o2A4okRm007168 for ; Tue, 9 Mar 2010 23:50:51 -0500 (EST) From: "Edward Z. Yang" To: sup-devel Date: Tue, 09 Mar 2010 23:50:23 -0500 Message-Id: <1268196562-sup-1692@ezyang> User-Agent: Sup/git X-Brightmail-Tracker: AAAAAQCq+Kk= Subject: [sup-devel] Mysterious nil errors X-BeenThere: sup-devel@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: 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 Here are some patches that correct some mysterious Nil errors. I don't know what messages caused them or if they're correct. I don't really want them to go in, but I would like to know further directions. diff --git a/lib/sup/message.rb b/lib/sup/message.rb index ebc73fc..ec12039 100644 --- a/lib/sup/message.rb +++ b/lib/sup/message.rb @@ -436,12 +436,12 @@ private end unless chunks - sibling_types = m.body.map { |p| p.header.content_type } + sibling_types = m.body.map { |p| p.header["content_type"] ? p.header.content_type : "application/unknown" } chunks = m.body.map { |p| message_to_chunks p, encrypted, sibling_types }.flatten.compact end chunks - elsif m.header.content_type && m.header.content_type.downcase == "message/rfc822" + elsif m.header["content_type"] && m.header.content_type && m.header.content_type.downcase == "message/rfc822" if m.body payload = RMail::Parser.read(m.body) from = payload.header.from.first ? payload.header.from.first.format : "" @@ -458,7 +458,7 @@ private debug "no body for message/rfc822 enclosure; skipping" [] end - elsif m.header.content_type && m.header.content_type.downcase == "application/pgp" && m.body + elsif m.header["content_type"] && m.header.content_type && m.header.content_type.downcase == "application/pgp" && m.body ## apparently some versions of Thunderbird generate encryped email that ## does not follow RFC3156, e.g. messages with X-Enigmail-Version: 0.95.0 ## they have no MIME multipart and just set the body content type to @@ -503,7 +503,7 @@ private # Lowercase the filename because searches are easier that way @attachments.push filename.downcase unless filename =~ /^sup-attachment-/ add_label :attachment unless filename =~ /^sup-attachment-/ - content_type = (m.header.content_type || "application/unknown").downcase # sometimes RubyMail gives us nil + content_type = (m.header["content_type"] && m.header.content_type || "application/unknown").downcase # sometimes RubyMail gives us nil [Chunk::Attachment.new(content_type, filename, m, sibling_types)] ## otherwise, it's body text diff --git a/lib/sup/modes/thread-index-mode.rb b/lib/sup/modes/thread-index-mode.rb index f53001f..84399d3 100644 --- a/lib/sup/modes/thread-index-mode.rb +++ b/lib/sup/modes/thread-index-mode.rb @@ -231,7 +231,7 @@ EOS old_cursor_thread = cursor_thread @mutex.synchronize do ## let's see you do THIS in python - @threads = @ts.threads.select { |t| !@hidden_threads[t] }.sort_by { |t| [t.date, t.first.id] }.reverse + @threads = @ts.threads.select { |t| !@hidden_threads[t] && t.first }.sort_by { |t| [t.date, t.first.id] }.reverse @size_widgets = @threads.map { |t| size_widget_for_thread t } @size_widget_width = @size_widgets.max_of { |w| w.display_length } @date_widgets = @threads.map { |t| date_widget_for_thread t } _______________________________________________ Sup-devel mailing list Sup-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-devel