Skip to content

Commit

Permalink
Fixed a crash when no template is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaKulkarni committed Jan 22, 2024
1 parent 64ff11c commit e41563b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/create-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ export async function createApp(config: CreateMagicAppConfig) {
};
});

const isChosenTemplateValid = availableScaffolds.map((i) => i.name).includes(config?.template!.toLowerCase());
const isChosenTemplateValid = availableScaffolds
.map((i) => i.name)
.includes((config?.template ? config.template : '').toLowerCase());

if (config?.template && !isChosenTemplateValid) {
printWarning(chalk`'{bold ${config.template}}' does not match any templates.`);
Expand Down

0 comments on commit e41563b

Please sign in to comment.