From 76961e5d5ab3a7bd108ff8dbaf63d7b99a405c25 Mon Sep 17 00:00:00 2001 From: miklosh Date: Sun, 19 Aug 2007 22:25:50 +0000 Subject: [PATCH] Added checks for pixbuf/pixmap allocation failure --- src/extension/internal/pdfinput/pdf-input.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index 759a84017..7def9927d 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -405,13 +405,18 @@ bool PdfImportDialog::_onExposePreview(GdkEventExpose *event) { #ifdef HAVE_POPPLER_CAIRO Glib::RefPtr 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 back_pixmap = Gdk::Pixmap::create(_previewArea->get_window(), _thumb_width, _thumb_height, -1); + if (!back_pixmap) { + return true; + } back_pixmap->draw_pixbuf(Glib::RefPtr(), thumb, 0, 0, 0, 0, - static_cast(_thumb_width), - static_cast(_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(); -- 2.30.2