Run firmware check first, as quasi-early exit, before checking vm devices.

This commit is contained in:
Florian Nücke
2022-01-27 11:15:14 +01:00
parent d9c86cbca5
commit 1ab2b8ea24

View File

@@ -304,6 +304,11 @@ public abstract class AbstractVirtualMachine implements VirtualMachine {
return;
}
if (busController.getDevices().stream().noneMatch(device -> device instanceof FirmwareLoader)) {
error(new TranslatableComponent(Constants.COMPUTER_ERROR_MISSING_FIRMWARE));
return;
}
final VMDeviceLoadResult loadResult = state.vmAdapter.mount();
if (!loadResult.wasSuccessful()) {
if (loadResult.getErrorMessage() != null) {
@@ -315,11 +320,6 @@ public abstract class AbstractVirtualMachine implements VirtualMachine {
return;
}
if (busController.getDevices().stream().noneMatch(device -> device instanceof FirmwareLoader)) {
error(new TranslatableComponent(Constants.COMPUTER_ERROR_MISSING_FIRMWARE));
return;
}
// May have a valid runner after load. In which case we just had to wait for
// bus setup and devices to load. So we can keep using it.
if (runner == null) {