From 467db84f828fb11783998e096ec3b9e7b8a3fb86 Mon Sep 17 00:00:00 2001 From: Andy Maloney Date: Mon, 10 Sep 2018 14:17:23 -0400 Subject: [PATCH] Check string length before trying to resize it Fixes #33 --- exif.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exif.cpp b/exif.cpp index 0cec9db..15a1105 100644 --- a/exif.cpp +++ b/exif.cpp @@ -349,7 +349,7 @@ IFEntry parseIFEntry_temp(const unsigned char *buf, const unsigned offs, } // and cut zero byte at the end, since we don't want that in the // std::string - if (result.val_string()[result.val_string().length() - 1] == '\0') { + if (result.length() && result.val_string()[result.val_string().length() - 1] == '\0') { result.val_string().resize(result.val_string().length() - 1); } break;