diff --git a/src/g_editor.c b/src/g_editor.c
index 289aa68e3efd23ab3e5c754283fbf5e8bd1e6aff..98d5599d0225e8296cbddc0c7f16465dc16bc48a 100644
--- a/src/g_editor.c
+++ b/src/g_editor.c
@@ -977,7 +977,7 @@ void canvas_vis(t_canvas *x, t_floatarg f)
     any missing paramters and redraw things if necessary. */
 void canvas_setgraph(t_glist *x, int flag, int nogoprect)
 {
-    t_editor editorwas = x->gl_editor;
+    t_editor *editorwas = x->gl_editor;
     if (editorwas)
         editor_free(x->gl_editor, x);
     if (!flag && glist_isgraph(x))