Code

fix crash when tracing with too small clones
authorbuliabyak <buliabyak@users.sourceforge.net>
Sat, 24 Feb 2007 17:32:52 +0000 (17:32 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Sat, 24 Feb 2007 17:32:52 +0000 (17:32 +0000)
src/dialogs/clonetiler.cpp

index 9687947547bfc7c74dcb941296570e7809c9543f..e063c80544bebbc744445c76df8cba96b8ce5a67 100644 (file)
@@ -788,6 +788,10 @@ clonetiler_trace_pick (NR::Rect box)
     guchar *px = g_new(guchar, 4 * width * height);
     memset(px, 0x00, 4 * width * height);
 
+    if (px == NULL) {
+        return 0; // buffer is too big or too small, cannot pick, so return 0
+    }
+
     /* Render */
     NRPixBlock pb;
     nr_pixblock_setup_extern( &pb, NR_PIXBLOCK_MODE_R8G8B8A8N,