Protect QImage::convertToFormat against null QImage

QImage may have a null d-pointer, and convertToFormat_helper was the
only method not protected against it.

Change-Id: Ibfe5b139e3922f2a0c8284c6ae1932c2150efc66
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Allan Sandfeld Jensen 2016-08-17 12:42:19 +02:00 committed by Allan Sandfeld Jensen
parent 2b0e52757c
commit 0d99452339

View File

@ -2117,7 +2117,7 @@ static QImage convertWithPalette(const QImage &src, QImage::Format format,
*/ */
QImage QImage::convertToFormat(Format format, const QVector<QRgb> &colorTable, Qt::ImageConversionFlags flags) const QImage QImage::convertToFormat(Format format, const QVector<QRgb> &colorTable, Qt::ImageConversionFlags flags) const
{ {
if (d->format == format) if (!d || d->format == format)
return *this; return *this;
if (format <= QImage::Format_Indexed8 && depth() == 32) { if (format <= QImage::Format_Indexed8 && depth() == 32) {