summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/filter/png/PngImageWriter.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/vcl/source/filter/png/PngImageWriter.cxx b/vcl/source/filter/png/PngImageWriter.cxx
index 0438ea7645a2..35ccefaec2c7 100644
--- a/vcl/source/filter/png/PngImageWriter.cxx
+++ b/vcl/source/filter/png/PngImageWriter.cxx
@@ -170,9 +170,12 @@ static bool pngWrite(SvStream& rStream, const BitmapEx& rBitmapEx, int nCompress
if (aBitmapEx.GetPrefMapMode().GetMapUnit() == MapUnit::Map100thMM)
{
Size aPrefSize(aBitmapEx.GetPrefSize());
- sal_uInt32 nPrefSizeX = o3tl::convert(aSize.Width(), 100000, aPrefSize.Width());
- sal_uInt32 nPrefSizeY = o3tl::convert(aSize.Height(), 100000, aPrefSize.Height());
- png_set_pHYs(pPng, pInfo, nPrefSizeX, nPrefSizeY, 1);
+ if (aPrefSize.Width() && aPrefSize.Height())
+ {
+ sal_uInt32 nPrefSizeX = o3tl::convert(aSize.Width(), 100000, aPrefSize.Width());
+ sal_uInt32 nPrefSizeY = o3tl::convert(aSize.Height(), 100000, aPrefSize.Height());
+ png_set_pHYs(pPng, pInfo, nPrefSizeX, nPrefSizeY, 1);
+ }
}
png_set_compression_level(pPng, nCompressionLevel);