From 7b11bbac18fc3c23c9c78ba1c4f9547c165a2613 Mon Sep 17 00:00:00 2001
From: Peter Hillman <peterh@wetafx.co.nz>
Date: Fri, 18 Sep 2020 08:47:21 +1200
Subject: [PATCH] add sanity check for reading multipart files with no parts

Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
---
 IlmImf/ImfMultiPartInputFile.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/IlmImf/ImfMultiPartInputFile.cpp b/IlmImf/ImfMultiPartInputFile.cpp
index 689956c90..cbb2ec234 100644
--- a/IlmImf/ImfMultiPartInputFile.cpp
+++ b/IlmImf/ImfMultiPartInputFile.cpp
@@ -340,6 +340,11 @@ MultiPartInputFile::initialize()
     // Perform usual check on headers.
     //
 
+    if ( _data->_headers.size() == 0)
+    {
+        throw IEX_NAMESPACE::ArgExc ("Files must contain at least one header");
+    }
+
     for (size_t i = 0; i < _data->_headers.size(); i++)
     {
         //
