diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js index eb9805547c67f2d41c966fbe535f2f3614f25db1..0911125afd57262028ef2a390fa536297f305969 100644 --- a/pd/nw/pdgui.js +++ b/pd/nw/pdgui.js @@ -3126,8 +3126,11 @@ function gui_textarea(cid, tag, type, x, y, max_char_width, text, function gui_undo_menu(cid, undo_text, redo_text) { // we have to check if the window exists, because Pd starts - // up with two unvis'd patch windows used for garrays - if (cid !== "nobody" && patchwin[cid] !== undefined) { + // up with two unvis'd patch windows used for garrays. Plus + // there may be some calls to subpatches after updating a dialog + // (like turning on GOP) which call this for a canvas that has + // been destroyed. + if (cid !== "nobody" && patchwin[cid]) { patchwin[cid].window.nw_undo_menu(undo_text, redo_text); } }