changeset 1196:4fe35e07308d

handle the case when io.open() fails
author nadvornik
date Sun, 07 Dec 2008 13:28:04 +0000
parents 98f8d5746b92
children 806664794967
files src/exiv2.cc
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/exiv2.cc	Sat Dec 06 21:24:38 2008 +0000
+++ b/src/exiv2.cc	Sun Dec 07 13:28:04 2008 +0000
@@ -145,9 +145,12 @@
 			Exiv2::BasicIo &io = image_->io();
 			gint open = io.isopen();
 			if (!open) io.open();
-			unsigned char *mapped = (unsigned char*)io.mmap();
-			if (mapped) exif_jpeg_parse_color(this, mapped, io.size());
-			io.munmap();
+			if (io.isopen())
+				{
+				unsigned char *mapped = (unsigned char*)io.mmap();
+				if (mapped) exif_jpeg_parse_color(this, mapped, io.size());
+				io.munmap();
+				}
 			if (!open) io.close();
 			}
 #endif