Permalink
Browse files

Handles the case where Google has no results

  • Loading branch information...
1 parent 243b79c commit 796f7beaf995a4ae8aa76c80a074f39fa291a156 @searls searls committed Oct 26, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/scripts/google.coffee
@@ -11,5 +11,5 @@ googleMe = (msg, query, cb) ->
msg.http('http://www.google.com/search')
.query(q: query)
.get() (err, res, body) ->
- cb body.match(/<a href="([^"]*)" class=l>/)[1]
+ cb body.match(/<a href="([^"]*)" class=l>/)?[1] || "Sorry, Google had zero results for '#{query}'"

0 comments on commit 796f7be

Please sign in to comment.