Fix conditional loop when there are no entries
authorFelipe Contreras <felipe.contreras@gmail.com>
Thu, 11 Oct 2012 17:42:11 +0000 (19:42 +0200)
committerKay Sievers <kay@vrfy.org>
Thu, 11 Oct 2012 15:46:43 +0000 (17:46 +0200)
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
gummiboot.c

index a65d5ac..a13e527 100644 (file)
@@ -1288,6 +1288,9 @@ static VOID config_default_entry_select(Config *config) {
         }
         config->idx_default_efivar = -1;
 
+        if (!config->entry_count)
+                return;
+
         /*
          * Match the pattern from the end of the list to the start, find last
          * entry (largest number) matching the given pattern.
@@ -1306,7 +1309,7 @@ static VOID config_default_entry_select(Config *config) {
         }
 
         /* select the last entry */
-        if (config->entry_count) {
+        {
                 UINTN i;
 
                 for (i = config->entry_count-1; i >= 0; i--) {