Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: "Edward Z. Yang" <ezyang@MIT.EDU>
To: sup-devel <sup-devel@rubyforge.org>
Subject: [sup-devel] [PATCH] Return nothing between if end index is not found.
Date: Sun, 18 Jul 2010 13:53:39 -0400	[thread overview]
Message-ID: <1279475566-sup-7173@ezyang> (raw)

This patch fixed Nil error that occurred when I had a GPG signed
mail with a starting marker but no ending marker.

From 22d12ffe7caa0d11c91876e2c8c7806854d0b3ab Mon Sep 17 00:00:00 2001
From: Edward Z. Yang <ezyang@mit.edu>
Date: Sun, 18 Jul 2010 03:38:52 -0400
Subject: [PATCH] Return nothing between if end index is not found.

Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
---
 lib/sup/util.rb |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lib/sup/util.rb b/lib/sup/util.rb
index d19caca..dad479f 100644
--- a/lib/sup/util.rb
+++ b/lib/sup/util.rb
@@ -479,6 +479,7 @@ module Enumerable
 
   ## returns all the entries which are equal to startline up to endline
   def between startline, endline
+    return [] if not index(endline)
     select { |l| true if l == startline .. l == endline }
   end
 end
-- 
1.7.0.4
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


             reply	other threads:[~2010-07-18 18:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-18 17:53 Edward Z. Yang [this message]
2010-07-19 22:50 ` Michael Stapelberg
2010-07-20 20:09   ` Michael Stapelberg
2010-08-15 23:30     ` Edward Z. Yang
2010-08-16  1:19       ` Michael Stapelberg
2010-08-16  1:40         ` Edward Z. Yang
2010-08-16 16:27           ` Alvaro Herrera
2010-08-16 17:22           ` Michael Stapelberg
2010-08-16 19:55             ` Edward Z. Yang
2010-08-17 22:46               ` Michael Stapelberg
2010-09-09 16:55                 ` Edward Z. Yang
2010-09-09 19:08                 ` Kevin Riggle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1279475566-sup-7173@ezyang \
    --to=ezyang@mit.edu \
    --cc=sup-devel@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox