diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js index 00a7ddde7..741c87ddf 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/store.js @@ -326,9 +326,11 @@ const store = createStore({ (e) => e.id === evaluationDest.id, ); - // add document to chosen evaluation - document.key = evaluationB.documents.length + 1; - evaluationB.documents.splice(0, 0, document); + if (evaluationB) { + // add document to chosen evaluation if evaluation is part of the same social work + document.key = evaluationB.documents.length + 1; + evaluationB.documents.splice(0, 0, document); + } // remove document from original evaluation const indexToRemove = evaluationA.documents.findIndex(