Make sure the DOM object is there before using it

This commit is contained in:
Hadi Nategh 2021-08-18 11:02:37 +02:00
parent 61cdef588a
commit 4e7ebc509a

View File

@ -782,7 +782,7 @@ export abstract class EgwApp
}) })
.addClass("ui-helper-clearfix"); .addClass("ui-helper-clearfix");
let el = document.getElementById('favorite_sidebox_'+this.appname).getElementsByTagName('ul')[0]; let el = document.getElementById('favorite_sidebox_'+this.appname)?.getElementsByTagName('ul')[0];
let sortablejs = Sortable.create(el, { let sortablejs = Sortable.create(el, {
ghostClass: 'ui-fav-sortable-placeholder', ghostClass: 'ui-fav-sortable-placeholder',
draggable: 'li:not([data-id$="add"])', draggable: 'li:not([data-id$="add"])',