diff --git a/client/salix/src/components/searchbar/searchbar.js b/client/salix/src/components/searchbar/searchbar.js index 769fdbd73..5f3ad79be 100644 --- a/client/salix/src/components/searchbar/searchbar.js +++ b/client/salix/src/components/searchbar/searchbar.js @@ -29,8 +29,11 @@ export default class Controller { if (this.onSearch) this.onSearch(); - angular.element(this.child).scope().$destroy(); - angular.element(this.child).remove(); + if (angular.element(this.child)) { + if (angular.element(this.child).scope()) + angular.element(this.child).scope().$destroy(); + angular.element(this.child).remove(); + } delete this.child; } $onDestroy() {