Skip to content

Commit aac6178

Browse files
committed
[DURACOM-247] Add condition to check function is not null
1 parent d2ec558 commit aac6178

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/app/core/lazy-service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import {
77
Observable,
88
} from 'rxjs';
99

10+
import { isNotEmpty } from '../shared/empty.util';
11+
1012
/**
1113
* Loads a service lazily. The service is loaded when the observable is subscribed to.
1214
*
@@ -26,7 +28,7 @@ export function lazyService<T>(
2628
injector: Injector,
2729
): Observable<T> {
2830
return defer(() => {
29-
if (typeof loader === 'function') {
31+
if (isNotEmpty(loader) && typeof loader === 'function') {
3032
return loader()
3133
.then((serviceOrDefault) => {
3234
if ('default' in serviceOrDefault) {

0 commit comments

Comments
 (0)