mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-10 10:58:33 +00:00
fix: omit port from upload request when not set
Previously, if the `port` was not set in IDE2, the compile request
object has been created with an empty port object (`{}`). From now on,
if the port is not specified, IDE2 will create a compile request with
the default `null` `port` value.
Closes #2089
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
@@ -411,17 +411,21 @@ export class CoreServiceImpl extends CoreClientAware implements CoreService {
|
||||
}
|
||||
}
|
||||
|
||||
private createPort(port: Port | undefined): RpcPort {
|
||||
private createPort(port: Port | undefined): RpcPort | undefined {
|
||||
if (!port) {
|
||||
return undefined;
|
||||
}
|
||||
const rpcPort = new RpcPort();
|
||||
if (port) {
|
||||
rpcPort.setAddress(port.address);
|
||||
rpcPort.setLabel(port.addressLabel);
|
||||
rpcPort.setProtocol(port.protocol);
|
||||
rpcPort.setProtocolLabel(port.protocolLabel);
|
||||
if (port.properties) {
|
||||
for (const [key, value] of Object.entries(port.properties)) {
|
||||
rpcPort.getPropertiesMap().set(key, value);
|
||||
}
|
||||
rpcPort.setAddress(port.address);
|
||||
rpcPort.setLabel(port.addressLabel);
|
||||
rpcPort.setProtocol(port.protocol);
|
||||
rpcPort.setProtocolLabel(port.protocolLabel);
|
||||
if (port.hardwareId !== undefined) {
|
||||
rpcPort.setHardwareId(port.hardwareId);
|
||||
}
|
||||
if (port.properties) {
|
||||
for (const [key, value] of Object.entries(port.properties)) {
|
||||
rpcPort.getPropertiesMap().set(key, value);
|
||||
}
|
||||
}
|
||||
return rpcPort;
|
||||
|
||||
Reference in New Issue
Block a user