Blob Blame History Raw
diff -upr gnuplot.orig/src/gplt_x11.c gnuplot/src/gplt_x11.c
--- gnuplot.orig/src/gplt_x11.c	2012-03-18 18:30:43.000000000 +0100
+++ gnuplot/src/gplt_x11.c	2012-08-17 15:11:31.888654269 +0200
@@ -2231,7 +2231,8 @@ exec_cmd(plot_struct *plot, char *comman
 	    /* Load selected pattern or fill into a separate gc */
 	    if (!fill_gc)
 		fill_gc = XCreateGC(dpy, plot->window, 0, 0);
-	    XCopyGC(dpy, *current_gc, ~0, fill_gc);
+	    if (current_gc)
+		    XCopyGC(dpy, *current_gc, ~0, fill_gc);
 	    x11_setfill(&fill_gc, style);
 
 	    /* gnuplot has origin at bottom left, but X uses top left
@@ -2560,7 +2561,8 @@ exec_cmd(plot_struct *plot, char *comman
 		/* Load selected pattern or fill into a separate gc */
 		if (!fill_gc)
 		    fill_gc = XCreateGC(dpy, plot->window, 0, 0);
-		XCopyGC(dpy, *current_gc, ~0, fill_gc);
+		if (current_gc)
+		    XCopyGC(dpy, *current_gc, ~0, fill_gc);
 
 		x11_setfill(&fill_gc, style);
 
@@ -2668,7 +2670,8 @@ exec_cmd(plot_struct *plot, char *comman
 		/* Load selected pattern or fill into a separate gc */
 		if (!fill_gc)
 		    fill_gc = XCreateGC(dpy, plot->window, 0, 0);
-		XCopyGC(dpy, *current_gc, ~0, fill_gc);
+		if (current_gc)
+		    XCopyGC(dpy, *current_gc, ~0, fill_gc);
 
 		x11_setfill(&fill_gc, style);