Bug 1571221 - Add a check for 'this.selection' before calling 'destroy()' on it r=gl

Added an if statement to check for `this.selection`. If it is truthy, `destroy()` will be called on it.

Differential Revision: https://phabricator.services.mozilla.com/D40643

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Krishnal Ciccolella 2019-08-05 15:37:16 +00:00
parent 670447873a
commit ce3d0217a4

View File

@ -509,7 +509,9 @@ class InspectorFront extends FrontClassWithSpec(inspectorSpec) {
destroy() {
// Selection isn't a Front and so isn't managed by InspectorFront
// and has to be destroyed manually
this.selection.destroy();
if (this.selection) {
this.selection.destroy();
}
// Highlighter fronts are managed by InspectorFront and so will be
// automatically destroyed. But we have to clear the `_highlighters`
// Map as well as explicitly call `finalize` request on all of them.