Skip to content

Commit 095bfb4

Browse files
committed
Slightly optimized method by removing redundant boolean flag
1 parent 19598fa commit 095bfb4

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

arduino-core/src/cc/arduino/packages/discoverers/serial/SerialDiscovery.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,18 @@ public synchronized void forceRefresh() {
162162
Map<String, Object> boardData = platform.resolveDeviceByVendorIdProductId(port, BaseNoGui.packages);
163163

164164
BoardPort boardPort = null;
165-
boolean updatingInfos = false;
166165
int i = 0;
167166
// create new board or update existing
168167
for (BoardPort board : boardPorts) {
169168
if (board.toString().equals(newPort)) {
170-
updatingInfos = true;
171169
boardPort = boardPorts.get(i);
172170
break;
173171
}
174172
i++;
175173
}
176-
if (!updatingInfos) {
174+
if (boardPort == null) {
177175
boardPort = new BoardPort();
176+
boardPorts.add(boardPort);
178177
}
179178
boardPort.setAddress(port);
180179
boardPort.setProtocol("serial");

0 commit comments

Comments
 (0)