Bug 1320399 - Fix error in Grip Rep; r=nchevobbe draft
authorNicolas Chevobbe <chevobbe.nicolas@gmail.com>
Sat, 26 Nov 2016 20:47:09 +0100
changeset 444188 e3b4efbc4957efdeda760917b6b7d22ad02f64ce
parent 443602 bad312aefb42982f492ad2cf36f4c6c3d698f4f7
child 538253 468215553d966d5bccc33b87ffa1f9c35a0008de
push id37218
push userchevobbe.nicolas@gmail.com
push dateSat, 26 Nov 2016 21:53:18 +0000
reviewersnchevobbe
bugs1320399
milestone53.0a1
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
devtools/client/shared/components/reps/grip.js
--- 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,
         })];
       }