Skip to content

Commit 331b30e

Browse files
JeanMechethePunderWoman
authored andcommitted
fix(core): support injection of object with null constructor. (#56553)
This is debug only code, it shouldn't have any consequences on prod build. fixes #56552 PR Close #56553
1 parent 4343cd2 commit 331b30e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/core/src/render3/debug/framework_injector_profiler.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,13 @@ function handleInstanceCreatedByInjectorEvent(
207207

208208
// if our value is an instance of a standalone component, map the injector of that standalone
209209
// component to the component class. Otherwise, this event is a noop.
210-
let standaloneComponent: Type<unknown> | undefined = undefined;
210+
let standaloneComponent: Type<unknown> | undefined | null = undefined;
211211
if (typeof value === 'object') {
212-
standaloneComponent = value?.constructor as Type<unknown>;
212+
standaloneComponent = value?.constructor as Type<unknown> | undefined | null;
213213
}
214-
if (standaloneComponent === undefined || !isStandaloneComponent(standaloneComponent)) {
214+
215+
// We want to also cover if `standaloneComponent === null` in addition to `undefined`
216+
if (standaloneComponent == undefined || !isStandaloneComponent(standaloneComponent)) {
215217
return;
216218
}
217219

0 commit comments

Comments
 (0)