This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 19febe2  Ignore invalid list headers (avoid NPEs)
19febe2 is described below

commit 19febe2d7d269033cb795f99b8e756b648c8870d
Author: Sebb <[email protected]>
AuthorDate: Thu Jun 29 16:33:28 2017 +0100

    Ignore invalid list headers (avoid NPEs)
---
 lib/whimsy/asf/mlist.rb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/whimsy/asf/mlist.rb b/lib/whimsy/asf/mlist.rb
index 5c27028..f8fe85f 100644
--- a/lib/whimsy/asf/mlist.rb
+++ b/lib/whimsy/asf/mlist.rb
@@ -49,7 +49,7 @@ module ASF
       File.read(LIST_SUBS).split(/\n\n/).each do |stanza|
         # list names can include '-': empire-db
         list = stanza.match(/\/([-\w]*\.?apache\.org)\/(.*?)(\n|\Z)/)
-
+        next unless list # ignore invalid list headers
         subs = stanza.scan(/^(.*@.*)/).flatten
         emails.each do |email|
           if subs.include? email
@@ -70,11 +70,13 @@ module ASF
       moderators = File.read(LIST_MODS).split(/\n\n/).map do |stanza|
         # list names can include '-': empire-db
         list = stanza.match(/\/([-\w]*\.?apache\.org)\/(.*?)\//)
+        next unless list # ignore invalid list headers
 
         ["#{list[2]}@#{list[1]}", stanza.scan(/^(.*@.*)/).flatten]
       end
 
-      moderators.each do |mail_list, list_moderators|
+      # need compact to skip invalid list headers [nil, nil]
+      moderators.compact.each do |mail_list, list_moderators|
         matches = (list_moderators & user_emails)
         response[:moderates][mail_list] = matches unless matches.empty?
       end

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to