From e2a83dc4e7e1591965e19f268fdb69aa2c6d90b7 Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Sun, 28 May 2017 15:06:00 -0400
Subject: [PATCH] protect against another out-of-order message from Pd

---
 pd/nw/pdgui.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/pd/nw/pdgui.js b/pd/nw/pdgui.js
index db240259a..9b074b430 100644
--- a/pd/nw/pdgui.js
+++ b/pd/nw/pdgui.js
@@ -2008,8 +2008,11 @@ function atom_arrow_points(width, height) {
 
 
 function gui_atom_draw_border(cid, tag, type, width, height) {
-    var g = get_gobj(cid, tag),
-        polygon, arrow, m;
+    var g, polygon, arrow, m;
+    if (!patchwin[cid]) {
+        return;
+    }
+    g = get_gobj(cid, tag),
     polygon = create_item(cid, "polygon", {
         points: atom_border_points(width, height, type !== 0),
         fill: "none",
-- 
GitLab