getPad fails if an invalid padID is passed and only two function arguments

This commit is contained in:
Petar Dobrev 2012-04-19 14:45:26 +03:00
parent 7ede4872b1
commit 96a0c0d0be

View file

@ -54,19 +54,19 @@ var padIdTransforms = [
*/ */
exports.getPad = function(id, text, callback) exports.getPad = function(id, text, callback)
{ {
//check if this is a valid padId
if(!exports.isValidPadId(id))
{
callback(new customError(id + " is not a valid padId","apierror"));
return;
}
//make text an optional parameter //make text an optional parameter
if(typeof text == "function") if(typeof text == "function")
{ {
callback = text; callback = text;
text = null; text = null;
} }
//check if this is a valid padId
if(!exports.isValidPadId(id))
{
callback(new customError(id + " is not a valid padId","apierror"));
return;
}
//check if this is a valid text //check if this is a valid text
if(text != null) if(text != null)