Check for at least one parameter.
This commit is contained in:
1 parent
9a05d10878
commit
69c8e6a438
1 file changed
+5
-1
+5
-1
@@ -52,7 +52,11 @@ sub calc
|
|||||||
my $json = JSON->new();
|
my $json = JSON->new();
|
||||||
# Put together the call to the Google Calculator API.
|
# Put together the call to the Google Calculator API.
|
||||||
my @args = @{ $data{args} };
|
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);
|
my $url = "http://www.google.com/ig/calculator?q=".uri_escape($expr);
|
||||||
# Get the response via HTTP.
|
# Get the response via HTTP.
|
||||||
my $response = $ua->get($url);
|
my $response = $ua->get($url);
|
||||||
|
|||||||
Reference in new issue
Block a user