OSDN Git Service

Copying from a blank doc makes no sense, don't try
authorAndrew Chadwick <andrewc-git@piffle.org>
Sat, 9 Jan 2010 00:15:28 +0000 (00:15 +0000)
committerMartin Renold <martinxyz@gmx.ch>
Sat, 9 Jan 2010 09:41:30 +0000 (10:41 +0100)
gui/drawwindow.py

index d3b7456..0c34591 100644 (file)
@@ -294,7 +294,11 @@ class Window(gtk.Window):
     def copy_cb(self, action):
         # use the full document bbox, so we can past layers back to the correct position
         bbox = self.doc.get_bbox()
-        pixbuf = self.doc.layer.surface.render_as_pixbuf(*bbox)
+        if bbox.w == 0 or bbox.h == 0:
+            print "WARNING: empty document, nothing copied"
+            return
+        else:
+            pixbuf = self.doc.layer.surface.render_as_pixbuf(*bbox)
         cb = gtk.Clipboard()
         cb.set_image(pixbuf)