diff --git a/CHANGELOG.md b/CHANGELOG.md index de87842b..da7794b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,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 1407b5d6..5054083f 100644 --- a/sharedPlugins/researchSync/index.js +++ b/sharedPlugins/researchSync/index.js @@ -186,8 +186,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)) { @@ -211,7 +216,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