From c055f2d12a54641a9139d078e77f6ac33c6637ef Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 25 Nov 2022 15:32:32 +0530 Subject: [PATCH] don't show zero MP --- src/components/PhotoViewer/FileInfo/index.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/PhotoViewer/FileInfo/index.tsx b/src/components/PhotoViewer/FileInfo/index.tsx index 1acc535cd..6fafab9d1 100644 --- a/src/components/PhotoViewer/FileInfo/index.tsx +++ b/src/components/PhotoViewer/FileInfo/index.tsx @@ -121,9 +121,12 @@ export function FileInfo({ const imageHeight = exif['ImageHeight'] ?? exif['ExifImageHeight']; if (imageWidth && imageHeight) { parsedExifData['resolution'] = `${imageWidth} x ${imageHeight}`; - parsedExifData['megaPixels'] = `${Math.round( - (imageWidth * imageHeight) / 1000000 - )}MP`; + const megaPixels = Math.round((imageWidth * imageHeight) / 1000000); + if (megaPixels) { + parsedExifData['megaPixels'] = `${Math.round( + (imageWidth * imageHeight) / 1000000 + )}MP`; + } } if (exif['Make'] && exif['Model']) { parsedExifData[