From 64dea6ccb009ab84ed3e3b7a9518efc4360410f4 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@vt.edu>
Date: Sat, 23 Aug 2014 12:18:52 -0400
Subject: [PATCH] *fixed regression where creating a new array from the put
 menu would segfault

---
 pd/src/g_array.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pd/src/g_array.c b/pd/src/g_array.c
index 1bd4516b3..34c44a04e 100644
--- a/pd/src/g_array.c
+++ b/pd/src/g_array.c
@@ -372,12 +372,13 @@ static int garray_get_largest_array(t_garray *x)
          1 = bounds, resize, and redraw */
 void garray_fittograph(t_garray *x, int n, int flag)
 {
-    int max_length = garray_get_largest_array(x);
-    //fprintf(stderr,"garray_fittograph n=%d flag=%d | max_length=%d\n", n, flag, max_length);
+    //fprintf(stderr,"garray_fittograph\n");
     // here we check for x->x_glist validity because when creating
     // a new array from the menu gl is null at the first garray_vis call
     if (!x->x_glist)
         return;
+    int max_length = garray_get_largest_array(x);
+    //fprintf(stderr,"garray_fittograph n=%d flag=%d | max_length=%d\n", n, flag, max_length);
     t_array *array = garray_getarray(x);
     t_garray *tmp;
     t_glist *gl = x->x_glist;
-- 
GitLab