search: don't try to escape nil

Fixes Homebrew/homebrew#9575.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Jack Nagel 2012-01-12 18:52:22 -06:00
parent e9a0f24ccb
commit 6d1ef8d9ca

View File

@ -9,8 +9,9 @@ module Homebrew extend self
exec "open", "http://pdb.finkproject.org/pdb/browse.php?summary=#{ARGV.next}"
else
query = ARGV.first
rx = if query =~ %r{^/(.*)/$}
Regexp.new($1)
rx = case query
when nil then ""
when %r{^/(.*)/$} then Regexp.new($1)
else
/.*#{Regexp.escape query}.*/i
end