From fda34407f97f5c779bb4c0aa55dd6428522723b8 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 15 Jul 2021 18:05:03 -0400 Subject: [PATCH] pad_editbar: Move `dropdowns` initialization to constructor This avoids null dereference if a buggy caller calls `toggleDropDown('none')` before `init()`. (Ideally the caller would be fixed, but this is not always feasible.) --- src/static/js/pad_editbar.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/static/js/pad_editbar.js b/src/static/js/pad_editbar.js index f25418e80..e973dc080 100644 --- a/src/static/js/pad_editbar.js +++ b/src/static/js/pad_editbar.js @@ -124,10 +124,9 @@ const syncAnimation = (() => { exports.padeditbar = { _editbarPosition: 0, + dropdowns: [], init() { - this.dropdowns = []; - $('#editbar .editbarbutton').attr('unselectable', 'on'); // for IE this.enable(); $('#editbar [data-key]').each((i, elt) => {