From d0823a0113253cf52859e84f41db82e96b80331e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 10 Jun 2009 11:14:45 +0200 Subject: Make sure QImage::mirrored() doesn't crash if it runs out of memory. Task-number: 255742 Reviewed-by: Kim --- src/gui/image/qimage.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 70d4e2c..338ae77 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4277,6 +4277,11 @@ QImage QImage::mirrored(bool horizontal, bool vertical) const int h = d->height; // Create result image, copy colormap QImage result(d->width, d->height, d->format); + + // check if we ran out of of memory.. + if (!result.d) + return QImage(); + result.d->colortable = d->colortable; result.d->has_alpha_clut = d->has_alpha_clut; -- cgit v0.12