mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-06 07:39:02 +02:00
added null check when filtering elements
This commit is contained in:
@@ -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]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user