diff --git a/src/navigation/index.js b/src/navigation/index.js index b9a8a99e16..6c8be11d2f 100644 --- a/src/navigation/index.js +++ b/src/navigation/index.js @@ -10,19 +10,22 @@ var navigation = {}, navigation.get = function(callback) { admin.get(function(err, data) { - callback(err, data - .filter(function(item) { - return item.enabled; - }) - .map(function(item) { - for (var i in item) { - if (item.hasOwnProperty(i)) { - item[i] = translator.unescape(item[i]); - } + if (err) { + return callback(err); + } + + data = data.filter(function(item) { + return item && item.enabled; + }).map(function(item) { + for (var i in item) { + if (item.hasOwnProperty(i)) { + item[i] = translator.unescape(item[i]); } + } + return item; + }); - return item; - })); + callback(null, data); }); };