From 52387ef66c12861b04b0969ee09cdbd131e8fc97 Mon Sep 17 00:00:00 2001
From: Roland Lutz <rlutz@hedmen.org>
Date: Tue, 11 Jul 2017 18:30:56 +0200
Subject: icemulti: Populate headers early

---
 icemulti/icemulti.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/icemulti/icemulti.cc b/icemulti/icemulti.cc
index d9c6dae..21ddc04 100644
--- a/icemulti/icemulti.cc
+++ b/icemulti/icemulti.cc
@@ -248,7 +248,9 @@ int main(int argc, char **argv)
     while (optind != argc) {
         if (image_count >= NUM_IMAGES)
             error("Too many images supplied\n");
-        images[image_count++].reset(new Image(argv[optind++]));
+        images[image_count].reset(new Image(argv[optind++]));
+        header_images[image_count + 1] = &*images[image_count];
+        image_count++;
     }
 
     if (coldboot && por_image != 0)
@@ -269,8 +271,6 @@ int main(int argc, char **argv)
     }
 
     // Populate headers
-    for (int i=0; i<image_count; i++)
-        header_images[i + 1] = &*images[i];
     header_images[0] = header_images[por_image + 1];
     for (int i=image_count; i < NUM_IMAGES; i++)
         header_images[i + 1] = header_images[0];
-- 
cgit v1.2.3