bitbake: toastergui: libtoaster: Add guard against missing name property

Add a debug warning if a JSON payload isn't compatible. i.e. without a
name field.

(Bitbake rev: e65de693670203ddcbf5f23ad2a91c523df879d8)

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Michael Wood
2015-07-31 15:09:15 +03:00
committed by Richard Purdie
parent a9549e839d
commit 1a2f12099c

View File

@@ -34,7 +34,14 @@ var libtoaster = (function (){
selectedCB(itemObj);
return item;
},
matcher: function(item) { return ~item.name.toLowerCase().indexOf(this.query.toLowerCase()); },
matcher: function(item) {
if (!item.hasOwnProperty('name')) {
console.log("Name property missing in data");
return 0;
}
return ~item.name.toLowerCase().indexOf(this.query.toLowerCase());
},
highlighter: function (item) {
if (item.hasOwnProperty('detail'))
/* Use jquery to escape the value as text into a span */