mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-23 13:51:11 +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)->
|
search = (searchFolder, path)->
|
||||||
count++
|
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
|
if !element? && searchFolder.folders? && searchFolder.folders.length != 0
|
||||||
_.each searchFolder.folders, (folder, index)->
|
_.each searchFolder.folders, (folder, index)->
|
||||||
newPath = {}
|
newPath = {}
|
||||||
|
@ -136,6 +136,6 @@ getIndexOf = (searchEntity, id)->
|
||||||
length = searchEntity.length
|
length = searchEntity.length
|
||||||
count = 0
|
count = 0
|
||||||
while(count < length)
|
while(count < length)
|
||||||
if searchEntity[count]._id+"" == id+""
|
if searchEntity[count]?._id+"" == id+""
|
||||||
return count
|
return count
|
||||||
count++
|
count++
|
||||||
|
|
|
@ -22,7 +22,7 @@ subFolder1 = name:"subFolder1", _id:"123asdjoij"
|
||||||
|
|
||||||
rootFolder =
|
rootFolder =
|
||||||
_id : "123sdskd"
|
_id : "123sdskd"
|
||||||
docs:[doc1, doc2, rootDoc]
|
docs:[doc1, doc2, null, rootDoc]
|
||||||
fileRefs:[file1]
|
fileRefs:[file1]
|
||||||
folders:[subFolder1, subFolder]
|
folders:[subFolder1, subFolder]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue