]> git.cworth.org Git - sup/commitdiff
Fix uninitialized @name member in person.rb.
authorCarl Worth <cworth@cworth.org>
Fri, 25 Sep 2009 20:41:06 +0000 (13:41 -0700)
committerCarl Worth <cworth@cworth.org>
Fri, 25 Sep 2009 20:42:19 +0000 (13:42 -0700)
Apparently a Person can be initialized with a nil name, (presumably
from a message where there's no name given), which before this commit
resulted in the following warning:

./lib/sup/person.rb:46: warning: instance variable @name not initialized

This warning was especially unpleasant since it appeared in the current
window, causing the terminal contents to incorrectly scroll up, (as
opposed to just appearing in the log or so).

lib/sup/person.rb

index c4f40a523e77907590d6eb1e546a37905fef6576..cd5b1ea59132b090cdfebe027621aff2353ae4a2 100644 (file)
@@ -11,6 +11,8 @@ class Person
       if @name =~ /^(['"]\s*)(.*?)(\s*["'])$/
         @name = $2
       end
+    else
+      @name = nil
     end
 
     @email = email.gsub(/^\s+|\s+$/, "").gsub(/\s+/, " ").downcase