From b02fcebac0b8c8cc411edd587747b60940547456 Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Fri, 28 Jul 2017 15:21:37 -0400
Subject: [PATCH] make mrpeach objects instantiate without arguments

---
 externals/mrpeach/net/udpreceive~.c | 10 ++++++++++
 externals/mrpeach/net/udpsend~.c    |  5 +++++
 2 files changed, 15 insertions(+)

diff --git a/externals/mrpeach/net/udpreceive~.c b/externals/mrpeach/net/udpreceive~.c
index 86a7f082b..9768baa54 100644
--- a/externals/mrpeach/net/udpreceive~.c
+++ b/externals/mrpeach/net/udpreceive~.c
@@ -670,7 +670,17 @@ static void *udpreceive_tilde_new(t_symbol *s, int argc, t_atom *argv)
 {
     t_udpreceive_tilde  *x;
     int                 i, j = 0, portno = 0, outlets = 0, blocksize = 0;
+    t_atom sane_defaults[2];
 
+    if (!argc)
+    {
+        post("udpreceive~: warning: no arguments provided: defaulting to "
+             "[updreceive~ 0]");
+        SETFLOAT(sane_defaults, 0.);
+        SETFLOAT(sane_defaults+1, 1.);
+        argc = 2;
+        argv = sane_defaults;
+    }
 
     x = (t_udpreceive_tilde *)pd_new(udpreceive_tilde_class);
     if (NULL == x) return NULL;
diff --git a/externals/mrpeach/net/udpsend~.c b/externals/mrpeach/net/udpsend~.c
index 5846524ab..77b514c0f 100644
--- a/externals/mrpeach/net/udpsend~.c
+++ b/externals/mrpeach/net/udpsend~.c
@@ -840,6 +840,11 @@ static void *udpsend_tilde_new(t_floatarg inlets, t_floatarg blocksize)
     t_udpsend_tilde *x = (t_udpsend_tilde *)pd_new(udpsend_tilde_class);
     if (x)
     {
+        if (inlets < 1.)
+        {
+            post("udpsend~: warning: no inlet argument given: defaulting to 1");
+            inlets = 1.;
+        }
         for (i = sizeof(t_object); i < (int)sizeof(t_udpsend_tilde); i++)
             ((char *)x)[i] = 0; 
 
-- 
GitLab