mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
added null check to where we insert elements into a project
This commit is contained in:
parent
d428e7e5b4
commit
0f4d9771aa
1 changed files with 4 additions and 0 deletions
|
@ -71,6 +71,10 @@ sanitizeTypeOfElement = (elementType)->
|
|||
return elementType
|
||||
|
||||
ProjectSchema.statics.putElement = (project_id, folder_id, element, type, callback)->
|
||||
if !element?
|
||||
e = new Error("no element passed to be inserted")
|
||||
logger.err project_id:project_id, folder_id:folder_id, element:element, type:type, "failed trying to insert element as it was null"
|
||||
return callback(e)
|
||||
type = sanitizeTypeOfElement type
|
||||
this.findById project_id, (err, project)=>
|
||||
if err?
|
||||
|
|
Loading…
Reference in a new issue