diff src/name/blackcap/imageprep/RotateDialog.kt @ 16:2bb46da74667

Detect unsupported file types on input.
author David Barts <n5jrn@me.com>
date Mon, 20 Jul 2020 12:56:07 -0700
parents 3feeb953d9ae
children 5fa5d15b4a7b
line wrap: on
line diff
--- a/src/name/blackcap/imageprep/RotateDialog.kt	Sun Jul 19 13:49:23 2020 -0700
+++ b/src/name/blackcap/imageprep/RotateDialog.kt	Mon Jul 20 12:56:07 2020 -0700
@@ -146,6 +146,8 @@
                 inBackground {
                     try {
                         val imageIn = ImageIO.read(input) /* IOException */
+                        if (imageIn == null)
+                            throw IOException("Unsupported file type.")
                         val ratio = Settings.maxDimension.toDouble() / max(imageIn.width, imageIn.height).toDouble()
                         if (ratio >= 1.0) {
                             Pair(null, null)