QImage::create fail if given an empty size

Previously valid but empty sizes i.e. QSize(0, 131073)
where accepted, but such sizes make no sense for an image
since they actually contain no pixels

Change-Id: Ie61e33401ad8aaea633646c66fc03f36793e839c
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
bb10
Albert Astals Cid 2018-12-21 14:59:43 +01:00
parent a21f3431b8
commit 9682d217e2
1 changed files with 1 additions and 1 deletions

View File

@ -117,7 +117,7 @@ QImageData::QImageData()
*/
QImageData * QImageData::create(const QSize &size, QImage::Format format)
{
if (!size.isValid() || format == QImage::Format_Invalid)
if (size.isEmpty() || format == QImage::Format_Invalid)
return nullptr; // invalid parameter(s)
int width = size.width();