From b9456d2e19840b981bded3cf51368a36727b4d3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bedn=C3=A1rik=20Boldizs=C3=A1r?= Date: Thu, 31 Mar 2022 19:02:42 +0200 Subject: [PATCH] Make sure input has correct format in generateCTXEnvironment I ran into some cases where input was undefined, and ionic run failed with `TypeError: Cannot convert undefined or null to object` , I propose making sure that input will not break the build process if there's something wrong with json config that it uses values from to run hooks. --- packages/@ionic/cli/src/lib/hooks.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/@ionic/cli/src/lib/hooks.ts b/packages/@ionic/cli/src/lib/hooks.ts index fb5c77d27a..d7d4532621 100644 --- a/packages/@ionic/cli/src/lib/hooks.ts +++ b/packages/@ionic/cli/src/lib/hooks.ts @@ -107,6 +107,8 @@ export abstract class Hook { private generateCTXEnvironment(input: HookInput, path: string[] = []): NodeJS.ProcessEnv { let environment: NodeJS.ProcessEnv = {}; + + input = !input ? {} : input; for (const [key, value] of Object.entries(input)) { if (typeof value === 'object') {