diff --git a/plugins/Google.py b/plugins/Google.py
index f2a960d9e..a31b14da5 100644
--- a/plugins/Google.py
+++ b/plugins/Google.py
@@ -170,9 +170,14 @@ class GooglePrivmsgRegexp(callbacks.PrivmsgRegexp):
threaded = True
def googleSnarfer(self, irc, msg, match):
r"^google\s+(.*)$"
- data = google.doGoogleSearch(match.group(1), safeSearch=1)
- url = data.results[0].URL
- irc.queueMsg(ircmsgs.privmsg(ircutils.replyTo(msg), url))
+ searchString = match.group(1)
+ data = google.doGoogleSearch(searchString, safeSearch=1)
+ if data.results:
+ url = data.results[0].URL
+ irc.queueMsg(ircmsgs.privmsg(ircutils.replyTo(msg), url))
+ else:
+ irc.queueMsg(ircmsgs.privmsg(ircutils.replyTo(msg),
+ 'No results for "%s"' % searchString))
_ggThread = re.compile(r'
Subject: ([^<]+)
')
_ggGroup = re.compile(r'Newsgroups: ]+>([^<]+)')