Check for callback argument in PTR lookup

This commit is contained in:
Krishna Rajendran
2010-03-17 01:13:45 -04:00
committed by Ryan Dahl
parent 31ed37fdf0
commit 84277ea845
2 changed files with 9 additions and 1 deletions

View File

@@ -443,6 +443,11 @@ static Handle<Value> Reverse(const Arguments& args) {
String::New("Argument must be a string.")));
}
if (!args[1]->IsFunction()) {
return ThrowException(Exception::Error(
String::New("Missing callback argument")));
}
String::Utf8Value ip_address(args[0]->ToString());
union {

View File

@@ -8,7 +8,10 @@ var dns = require("dns"),
assert.throws(function () {
dns.resolve('google.com', 'A');
})
});
assert.throws(function () {
dns.resolve('127.0.0.1', 'PTR');
});
var hosts = ['example.com', 'example.org',