Permalink
Browse files

Guard clause for nil message

  • Loading branch information...
1 parent a9bf1e6 commit add4ed388a865f945c060c8d2e24b9ce75db696e Avdi Grimm committed Jan 10, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/cowsay.rb
View
@@ -8,14 +8,14 @@ def initialize(options={})
end
def say(message, options={})
+ return "" if message.nil?
command = "cowsay"
if options[:strings] && options[:strings][:eyes]
command << " -e '#{options[:strings][:eyes]}'"
end
messages = case message
when Array then message
- when nil then []
else [message]
end
results = []

0 comments on commit add4ed3

Please sign in to comment.