Skip to content

Commit 756ed68

Browse files
authored
Select desktop or web if no other device is available (#6100)
* Select disktop or web if no other device is available * Typo
1 parent d40ab0c commit 756ed68

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

flutter-idea/src/io/flutter/run/daemon/DeviceSelection.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,12 @@ DeviceSelection withDevices(@NotNull List<FlutterDevice> newDevices) {
4646
final Optional<FlutterDevice> selectedDevice = findById(newDevices, selectedId);
4747

4848
// If there's no selected device, default the first ephemoral one in the list.
49-
final FlutterDevice firstEphemoral =
49+
FlutterDevice firstEphemeral =
5050
newDevices.stream().filter(FlutterDevice::ephemeral).findFirst().orElse(null);
51-
return new DeviceSelection(ImmutableList.copyOf(newDevices), selectedDevice.orElse(firstEphemoral));
51+
if (firstEphemeral == null && !newDevices.isEmpty()) {
52+
firstEphemeral = newDevices.get(0);
53+
}
54+
return new DeviceSelection(ImmutableList.copyOf(newDevices), selectedDevice.orElse(firstEphemeral));
5255
}
5356

5457
/**

0 commit comments

Comments
 (0)