Skip to content

Node.js based forum software built for the modern web

bulk fix

barisusakli59120df71ca8
diff --git a/src/controllers/index.js b/src/controllers/index.js
index 872eedd9d8..0dabd3dcab 100644
--- a/src/controllers/index.js
+++ b/src/controllers/index.js
@@ -76,7 +76,7 @@ Controllers.home = function(req, res, next) {
childCategories.push.apply(childCategories, categoryData[i].children);
}
- if (categoryData[i].parent) {
+ if (categoryData[i].parent && categoryData[i].parent.cid) {
categoryData.splice(i, 1);
}
}
diff --git a/src/database/mongo/sets.js b/src/database/mongo/sets.js
index a48b51cded..78e501cbd9 100644
--- a/src/database/mongo/sets.js
+++ b/src/database/mongo/sets.js
@@ -33,6 +33,11 @@ module.exports = function(db, module) {
module.setsAdd = function(keys, value, callback) {
callback = callback || helpers.noop;
+
+ if (!Array.isArray(keys) || !keys.length) {
+ return callback();
+ }
+
if(!Array.isArray(value)) {
value = [value];
}