[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sup-devel] [PATCH] Return nothing between if end index is not found.



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