From ea811da0daa109f31126aa06cdcdd377e56159f8 Mon Sep 17 00:00:00 2001
From: Ivica Ico Bukvic <ico@monsoon.(none)>
Date: Mon, 24 Oct 2011 03:50:15 -0400
Subject: [PATCH] Fixed segfault when trying to paste partially copied (and
 thus erroneous) patch from an external source (e.g. a text editor) where the
 copied contents contain only "connect" instructions.

---
 src/g_editor.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/g_editor.c b/src/g_editor.c
index 80b484e67..59cffcc9c 100644
--- a/src/g_editor.c
+++ b/src/g_editor.c
@@ -3788,6 +3788,10 @@ extern t_class *text_class;
 void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutno,
     t_floatarg fwhoin, t_floatarg finno)
 {
+	if (!x->gl_list) {
+		post("paste error: no objects to connect, probably incomplete clipboard copy from an external source (e.g. from a text editor)");
+		return;		
+	}
     int whoout = fwhoout, outno = foutno, whoin = fwhoin, inno = finno;
     t_gobj *src = 0, *sink = 0;
     t_object *objsrc, *objsink;
-- 
GitLab