diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c index 794f75897038c953c3a7cf873ad1defaf5d22fef..9f9281acb1f6073cdd15a7981d76332992c50077 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;