diff --git a/CHANGELOG.md b/CHANGELOG.md index 994793f7..bc6b8b4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ Version 1.2.2 when researching it and another node completes it in researchSync. - Fixed progress of a previous infinite tech from another node being applied to the current one in researchSync. +- Fixed crash in researchSync when modded technologies are present only on some + nodes. Version 1.2.1 diff --git a/sharedPlugins/researchSync/index.js b/sharedPlugins/researchSync/index.js index 17ee5c09..1a0cdd7d 100644 --- a/sharedPlugins/researchSync/index.js +++ b/sharedPlugins/researchSync/index.js @@ -211,8 +211,13 @@ class ResearchSync { } recount_cluster_research_progress(slaves_data, cluster_researches) { - for (let [name, tech] of Object.entries(cluster_researches)) - tech.progress = this.research[name].contribution + for (let [name, tech] of Object.entries(cluster_researches)) { + if (Object.hasOwnProperty.call(this.research, name)) { + tech.progress = this.research[name].contribution + } else { + tech.progress = 0; + } + } for (let slave_data of slaves_data) { for (let [name, tech] of Object.entries(slave_data.meta.research)) { @@ -236,7 +241,7 @@ class ResearchSync { } for (let [name, tech] of Object.entries(cluster_researches)) { - if (tech.progress > 1) { + if (Object.hasOwnProperty.call(this.research, name) && tech.progress > 1) { tech.progress = null tech.researched = 1 this.research[name].contribution = 0