From 2dfd7f506da2301b2be800bf66de668941bdb4bc Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Fri, 20 Jul 2018 16:28:50 +0200
Subject: [PATCH] when projectId is equal to array function name system crashed

---
 frontend-js/src/main/js/ServerConnector.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/frontend-js/src/main/js/ServerConnector.js b/frontend-js/src/main/js/ServerConnector.js
index dff12e596f..8801a35ab1 100644
--- a/frontend-js/src/main/js/ServerConnector.js
+++ b/frontend-js/src/main/js/ServerConnector.js
@@ -811,7 +811,7 @@ ServerConnector.getProject = function (projectId) {
       return null;
     } else {
       var downloadedProject = new Project(content);
-      if (self._projectsById[projectId] !== undefined) {
+      if (self._projectsById[projectId] instanceof Project) {
         self._projectsById[projectId].update(downloadedProject);
       } else {
         self._projectsById[projectId] = downloadedProject;
@@ -956,7 +956,7 @@ ServerConnector.getProjects = function (reload) {
       self._projects.length = 0;
       for (var i = 0; i < parsedData.length; i++) {
         var project = new Project(JSON.stringify(parsedData[i]));
-        if (self._projectsById[project.getProjectId()] !== undefined) {
+        if (self._projectsById[project.getProjectId()] instanceof Project) {
           self._projectsById[project.getProjectId()].update(project);
         } else {
           self._projectsById[project.getProjectId()] = project;
-- 
GitLab