From 7c84d8cc7483e978e2aeafc75b487de8a33f50e7 Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 22 Dec 2011 00:22:36 -0500 Subject: [PATCH] Bugfix to API calling indexOf on an undefined padID --- node/db/API.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/node/db/API.js b/node/db/API.js index 90bfd8f6..09cc95af 100644 --- a/node/db/API.js +++ b/node/db/API.js @@ -293,7 +293,7 @@ Example returns: exports.createPad = function(padID, text, callback) { //ensure there is no $ in the padID - if(padID.indexOf("$") != -1) + if(padID && padID.indexOf("$") != -1) { callback(new customError("createPad can't create group pads","apierror")); return; @@ -360,7 +360,7 @@ Example returns: exports.setPublicStatus = function(padID, publicStatus, callback) { //ensure this is a group pad - if(padID.indexOf("$") == -1) + if(padID && padID.indexOf("$") == -1) { callback(new customError("You can only get/set the publicStatus of pads that belong to a group","apierror")); return; @@ -393,7 +393,7 @@ Example returns: exports.getPublicStatus = function(padID, callback) { //ensure this is a group pad - if(padID.indexOf("$") == -1) + if(padID && padID.indexOf("$") == -1) { callback(new customError("You can only get/set the publicStatus of pads that belong to a group","apierror")); return; @@ -419,7 +419,7 @@ Example returns: exports.setPassword = function(padID, password, callback) { //ensure this is a group pad - if(padID.indexOf("$") == -1) + if(padID && padID.indexOf("$") == -1) { callback(new customError("You can only get/set the password of pads that belong to a group","apierror")); return; @@ -448,7 +448,7 @@ Example returns: exports.isPasswordProtected = function(padID, callback) { //ensure this is a group pad - if(padID.indexOf("$") == -1) + if(padID && padID.indexOf("$") == -1) { callback(new customError("You can only get/set the password of pads that belong to a group","apierror")); return;