diff --git a/client/index.html b/client/index.html index 492e2a7..c1273e9 100644 --- a/client/index.html +++ b/client/index.html @@ -25,7 +25,7 @@ diff --git a/server/search.js b/server/search.js index 4d818d0..f31cbb4 100644 --- a/server/search.js +++ b/server/search.js @@ -235,7 +235,7 @@ function computeRecordCompat(records, context, callback) { function fixupProfile(profile) { var fixed = {}; - _.each(JSON.parse(profile), function(value, key) { + _.each(JSON.parse(profile || '{}'), function(value, key) { if (parseFloat(value) !== 0) { fixed[key] = value; } @@ -255,9 +255,13 @@ function fixupFeatures(features) { 'compatible' ]; + if (!features) { + features = {}; + } + var fixed = {}; _.each(keys, function(key) { - fixed[key] = _.has(features, key) ? features[key] : 0; + fixed[key] = features[key] || 0; }); return fixed; @@ -270,7 +274,10 @@ function getCategories(callback) { } var categories = _.map(rows, function(row) { - return {id: row.id, description: row.description}; + return { + id: row.id, + description: row.description + }; }); callback(categories);