From c65b1a8704a6f8e9da001a33c653f204235fe47d Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Wed, 17 Sep 2014 06:54:23 -0400
Subject: [PATCH] *added additional check to protect against null groupcanvas
 pointers

---
 pd/src/g_scalar.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/pd/src/g_scalar.c b/pd/src/g_scalar.c
index ab8315f15..f035bcf16 100644
--- a/pd/src/g_scalar.c
+++ b/pd/src/g_scalar.c
@@ -846,13 +846,14 @@ int scalar_doclick(t_word *data, t_template *template, t_scalar *sc,
     if (xloc != 0.0 || yloc != 0.0)
     {
         //fprintf(stderr,"ignoring\n");
-        basex = 0.0;
-        basey = 0.0;
+        //basex = 0.0;
+        //basey = 0.0;
     }
 
-    hit = scalar_groupclick(templatecanvas, data, template, sc, ap,
-                owner, xloc, yloc, xpix, ypix,
-                shift, alt, dbl, doit, basex, basey);
+    if (templatecanvas)
+        hit = scalar_groupclick(templatecanvas, data, template, sc, ap,
+                    owner, xloc, yloc, xpix, ypix,
+                    shift, alt, dbl, doit, basex, basey);
     return hit;
 }
 
-- 
GitLab