From 0a81b530327709b6b2547704a411f7c98740d51e Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Fri, 28 Aug 2015 17:33:50 -0400
Subject: [PATCH] Fix regression due to not checking for existence with scalar
 "Open" menu

---
 pd/src/g_editor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index 794f75897..9f9281acb 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -2348,7 +2348,7 @@ static void canvas_rightclick(t_canvas *x, int xpos, int ypos, t_gobj *y_sel)
     canopen = (y && zgetfn(&y->g_pd, gensym("menu-open")));
     /* we add an extra check for scalars to enable the "Open" button
        if they happen to have a canvas field inside them. */
-    if (pd_class(&y->g_pd) == scalar_class)
+    if (y && pd_class(&y->g_pd) == scalar_class)
     {
         if (scalar_getcanvasfield((t_scalar *)y))
             scalar_has_canvas = 1;
-- 
GitLab