Skip to content

Commit

Permalink
* fixed: #778 -- Idea run dialog was not saving Sim details if no dev…
Browse files Browse the repository at this point in the history
…ice is attached and selected in preferred device udid (#779)

exception:
> java.lang.NullPointerException: Cannot read field "id" because the return value of "org.robovm.idea.running.RoboVmIOSRunConfigurationSettingsEditor$Decorator.from(javax.swing.JComboBox)" is null
  • Loading branch information
dkimitsa authored Apr 6, 2024
1 parent 24c3aa8 commit 7080cc8
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.robovm.compiler.target.ios.ProvisioningProfile;
import org.robovm.compiler.target.ios.SigningIdentity;
import org.robovm.compiler.util.InfoPList;
import org.robovm.compiler.util.PList;
import org.robovm.idea.RoboVmPlugin;
import org.robovm.idea.running.RoboVmRunConfiguration.EntryType;
import org.robovm.libimobiledevice.IDevice;
Expand Down Expand Up @@ -194,7 +193,8 @@ protected void applyEditorTo(@NotNull RoboVmRunConfiguration config) throws Conf
config.setSigningIdentity(Decorator.from(signingIdentity).id);
config.setProvisioningProfileType(Decorator.from(provisioningProfile).entryType);
config.setProvisioningProfile(Decorator.from(provisioningProfile).id);
config.setTargetDeviceUDID(Decorator.from(targetDeviceUDID).id);
// TargetDeviceUDID is optional
config.setTargetDeviceUDID(Decorator.idOrNullFrom(targetDeviceUDID));
// simulator related
config.setSimulatorArch((CpuArch) simArch.getSelectedItem());
config.setSimulatorType(Decorator.from(simType).entryType);
Expand Down Expand Up @@ -816,6 +816,15 @@ static <T> Decorator<T> from(JComboBox<? extends Decorator<T>> cb) {
//noinspection unchecked
return (Decorator<T>) cb.getSelectedItem();
}

/**
* @return id from decorator if it presents
*/
static <T> String idOrNullFrom(JComboBox<? extends Decorator<T>> cb) {
//noinspection unchecked
Decorator<T> decorator = (Decorator<T>) cb.getSelectedItem();
return decorator != null ? decorator.id : null;
}
}

/**
Expand Down

0 comments on commit 7080cc8

Please sign in to comment.