Skip to content

Commit f5033f9

Browse files
authored
Merge pull request #1877 from NativeScript/deploy-can-execute
Can execute improved
2 parents 5776d8e + 915754b commit f5033f9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/services/platform-service.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -469,17 +469,20 @@ export class PlatformService implements IPlatformService {
469469
}
470470

471471
private getCanExecuteAction(platform: string): any {
472-
let canExecute = (device: Mobile.IDevice): boolean => {
473-
if (this.$options.device) {
474-
return device.deviceInfo.identifier === this.$devicesService.getDeviceByDeviceOption().deviceInfo.identifier;
472+
let canExecute = (currentDevice: Mobile.IDevice): boolean => {
473+
if (this.$options.device && currentDevice && currentDevice.deviceInfo) {
474+
let device = this.$devicesService.getDeviceByDeviceOption();
475+
if (device && device.deviceInfo) {
476+
return currentDevice.deviceInfo.identifier === device.deviceInfo.identifier;
477+
}
475478
}
476479

477480
if (this.$mobileHelper.isiOSPlatform(platform) && this.$hostInfo.isDarwin) {
478-
if (this.$devicesService.isOnlyiOSSimultorRunning()) {
481+
if (this.$devicesService.isOnlyiOSSimultorRunning() || this.$options.emulator || this.$devicesService.isiOSSimulator(currentDevice)) {
479482
return true;
480483
}
481484

482-
return this.$options.emulator ? this.$devicesService.isiOSSimulator(device) : this.$devicesService.isiOSDevice(device);
485+
return this.$devicesService.isiOSDevice(currentDevice);
483486
}
484487

485488
return true;

0 commit comments

Comments
 (0)