From 69c8e6a438eb40112c9163e72af9e7a7c716cb1c Mon Sep 17 00:00:00 2001 From: Elijah Perrault Date: Wed, 2 Feb 2011 12:09:25 -0700 Subject: [PATCH] Check for at least one parameter. --- modules/Calc.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/Calc.pm b/modules/Calc.pm index c60762a..3778d37 100644 --- a/modules/Calc.pm +++ b/modules/Calc.pm @@ -52,7 +52,11 @@ sub calc my $json = JSON->new(); # Put together the call to the Google Calculator API. my @args = @{ $data{args} }; - my $expr = join(' ', @args); + if (!defined $args[0]) { + notice($data{svr}, $data{nick}, trans("Not enough parameters")."."); + return 0; + } + my $expr = join(' ', @args); my $url = "http://www.google.com/ig/calculator?q=".uri_escape($expr); # Get the response via HTTP. my $response = $ua->get($url);