Skip to content

Commit

Permalink
fix(cli): avoid error when config.xml has no preferences (#2627)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Mar 24, 2020
1 parent 9dcb2ff commit 6c0dc4b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cli/src/cordova.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,11 @@ export async function getCordovaPreferences(config: Config) {
if (existsSync(configXml)) {
cordova.preferences = {};
const xmlMeta = await readXML(configXml);
xmlMeta.widget.preference.map((pref: any) => {
cordova.preferences[pref.$.name] = pref.$.value;
});
if (xmlMeta.widget.preference) {
xmlMeta.widget.preference.map((pref: any) => {
cordova.preferences[pref.$.name] = pref.$.value;
});
}
}
if (config.app.extConfig && config.app.extConfig.cordova && config.app.extConfig.cordova.preferences && cordova.preferences) {
const answer = await inquirer.prompt({
Expand Down

0 comments on commit 6c0dc4b

Please sign in to comment.