Bug 1320399 - Fix error in Grip Rep; r=nchevobbe
Check that the `preview` property is not null before using it.
The bug was harmless because we catch it and return an
empty array as the properties of the grip, which is the same
when we don't have anything in the preview prop.
MozReview-Commit-ID: COU8XLATw7x
--- a/devtools/client/shared/components/reps/grip.js
+++ b/devtools/client/shared/components/reps/grip.js
@@ -47,17 +47,17 @@ define(function (require, exports, modul
return this.propIterator(object, max);
} catch (err) {
console.error(err);
}
return [];
},
propIterator: function (object, max) {
- if (Object.keys(object.preview).includes("wrappedValue")) {
+ if (object.preview && Object.keys(object.preview).includes("wrappedValue")) {
const { Rep } = createFactories(require("./rep"));
return [Rep({
object: object.preview.wrappedValue,
mode: this.props.mode || MODE.TINY,
defaultRep: Grip,
})];
}