Code

Added checks for pixbuf/pixmap allocation failure
authormiklosh <miklosh@users.sourceforge.net>
Sun, 19 Aug 2007 22:25:50 +0000 (22:25 +0000)
committermiklosh <miklosh@users.sourceforge.net>
Sun, 19 Aug 2007 22:25:50 +0000 (22:25 +0000)
src/extension/internal/pdfinput/pdf-input.cpp

index 759a84017c81fbe0008aa7de0c40b0cae06457b9..7def9927d1ccefac0ca045535982cd48fbba37c1 100644 (file)
@@ -405,13 +405,18 @@ bool PdfImportDialog::_onExposePreview(GdkEventExpose *event) {
 #ifdef HAVE_POPPLER_CAIRO
     Glib::RefPtr<Gdk::Pixbuf> thumb = Gdk::Pixbuf::create(Gdk::COLORSPACE_RGB, true,
             8, _thumb_width, _thumb_height);
+    if (!thumb) {
+        return true;
+    }
     // Set background to white
     thumb->fill(0xffffffff);
     Glib::RefPtr<Gdk::Pixmap> back_pixmap = Gdk::Pixmap::create(_previewArea->get_window(),
             _thumb_width, _thumb_height, -1);
+    if (!back_pixmap) {
+        return true;
+    }
     back_pixmap->draw_pixbuf(Glib::RefPtr<Gdk::GC>(), thumb, 0, 0, 0, 0,
-                             static_cast<int>(_thumb_width),
-                             static_cast<int>(_thumb_height),
+                             _thumb_width, _thumb_height,
                              Gdk::RGB_DITHER_NONE, 0, 0);
     _previewArea->get_window()->set_back_pixmap(back_pixmap, false);
     _previewArea->get_window()->clear();