From 205dfaa87262a343c608a02fcc75b09914c51464 Mon Sep 17 00:00:00 2001 From: Tom Feist Date: Wed, 20 Jul 2011 09:38:54 +0100 Subject: add additional check to avoid crash if URI doesn't have a 'host' method. --- longify/longify-urls.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/longify/longify-urls.pl b/longify/longify-urls.pl index 38e8ba8..cd36503 100644 --- a/longify/longify-urls.pl +++ b/longify/longify-urls.pl @@ -130,7 +130,12 @@ sub _handle_messages { my $uri_obj = URI->new($url); - return unless ref($uri_obj) && exists $domains->{$uri_obj->host}; + # check we've got a valid url + return unless ref($uri_obj); + return unless $uri_obj->can('host'); + + # match against the whitelist. + return unless exists $domains->{$uri_obj->host}; $pending_msg_params->{$url} = [@_]; $lookup_in_progress = 1; -- cgit v1.2.3