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,13 +54,6 @@ var padIdTransforms = [
*/
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
if(typeof text == "function")
{
@ -68,6 +61,13 @@ exports.getPad = function(id, text, callback)
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
if(text != null)
{