mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 15:12:51 +08:00
CB-13571: (android) Prevent crash with unrecognized android version
Fixes issue where commands that list images will crash when an image with a version not present in `android-versions` is encountered, as is presently the case with API 27: ``` cordova run android --list Available android devices: Available android virtual devices: LEVEL: null ERROR: TypeError: Cannot read property 'semver' of null An unexpected error has occured while running list-emulator-images with code 2: Error: /home/chris/Repositories/acp-guidelines/cordova/platforms/android/cordova/lib/list-emulator-images: Command failed with exit code 2 ``` Signed-off-by: Chris Alfano <chris@jarv.us>
This commit is contained in:
parent
a24ba41eda
commit
109112ae75
4
bin/templates/cordova/lib/emulator.js
vendored
4
bin/templates/cordova/lib/emulator.js
vendored
@ -187,7 +187,9 @@ module.exports.list_images = function () {
|
||||
var api_level = avd.target.match(/\d+/);
|
||||
if (api_level) {
|
||||
var level = android_versions.get(api_level);
|
||||
avd.target = 'Android ' + level.semver + ' (API level ' + api_level + ')';
|
||||
if (level) {
|
||||
avd.target = 'Android ' + level.semver + ' (API level ' + api_level + ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
return avd;
|
||||
|
Loading…
Reference in New Issue
Block a user