mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-23 08:10:56 +00:00
added null check when filtering elements
This commit is contained in:
parent
e7f8d11e45
commit
b7104a82e9
2 changed files with 3 additions and 3 deletions
|
@ -17,7 +17,7 @@ module.exports =
|
|||
|
||||
search = (searchFolder, path)->
|
||||
count++
|
||||
element = _.find searchFolder[elementType], (el)-> el._id+'' == element_id+'' #need to ToString both id's for robustness
|
||||
element = _.find searchFolder[elementType], (el)-> el?._id+'' == element_id+'' #need to ToString both id's for robustness
|
||||
if !element? && searchFolder.folders? && searchFolder.folders.length != 0
|
||||
_.each searchFolder.folders, (folder, index)->
|
||||
newPath = {}
|
||||
|
@ -136,6 +136,6 @@ getIndexOf = (searchEntity, id)->
|
|||
length = searchEntity.length
|
||||
count = 0
|
||||
while(count < length)
|
||||
if searchEntity[count]._id+"" == id+""
|
||||
if searchEntity[count]?._id+"" == id+""
|
||||
return count
|
||||
count++
|
||||
|
|
|
@ -22,7 +22,7 @@ subFolder1 = name:"subFolder1", _id:"123asdjoij"
|
|||
|
||||
rootFolder =
|
||||
_id : "123sdskd"
|
||||
docs:[doc1, doc2, rootDoc]
|
||||
docs:[doc1, doc2, null, rootDoc]
|
||||
fileRefs:[file1]
|
||||
folders:[subFolder1, subFolder]
|
||||
|
||||
|
|
Loading…
Reference in a new issue