Преглед на файлове

tools/flashmax.pl: correct flashing when no file is provided

When no firmware file is provided but flashing is to be done
(e.g. --setver), then the program would crash with an undefined
reference.

Don't do that, it's mean.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
H. Peter Anvin преди 1 година
родител
ревизия
987cdc3e28
променени са 1 файла, в които са добавени 6 реда и са изтрити 2 реда
  1. 6 2
      tools/flashmax.pl

+ 6 - 2
tools/flashmax.pl

@@ -901,8 +901,12 @@ if (defined($target_board)) {
     }
 }
 
-my($fwfiles, $fpgadata) = read_fwfile($file, $target_board);
-push(@espfiles, @$fwfiles);
+my $fpgadata;
+if (defined($file)) {
+    my $fwfiles;
+    ($fwfiles, $fpgadata) = read_fwfile($file, $target_board);
+    push(@espfiles, @$fwfiles) if (defined($fwfiles));
+}
 
 if (!$fpgaonly && scalar(@espfiles)) {
     run_esptool($port, { hgrep {!/^flash_/} %espopt },