mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 15:04:52 +09:00
Fix crash in recount_cluster_research_progress
Check that the relevant research is present in the research mapping before accessing it in recount_cluster_research_progress.
This commit is contained in:
1 parent
075d54f708
commit
0cdb5d0ce4
2 files changed
+10
-3
No files matched your search
@@ -10,6 +10,8 @@ Version 1.2.2
|
|||||||
when researching it and another node completes it in researchSync.
|
when researching it and another node completes it in researchSync.
|
||||||
- Fixed progress of a previous infinite tech from another node being applied
|
- Fixed progress of a previous infinite tech from another node being applied
|
||||||
to the current one in researchSync.
|
to the current one in researchSync.
|
||||||
|
- Fixed crash in researchSync when modded technologies are present only on some
|
||||||
|
nodes.
|
||||||
|
|
||||||
|
|
||||||
Version 1.2.1
|
Version 1.2.1
|
||||||
|
|||||||
@@ -211,8 +211,13 @@ class ResearchSync {
|
|||||||
}
|
}
|
||||||
|
|
||||||
recount_cluster_research_progress(slaves_data, cluster_researches) {
|
recount_cluster_research_progress(slaves_data, cluster_researches) {
|
||||||
for (let [name, tech] of Object.entries(cluster_researches))
|
for (let [name, tech] of Object.entries(cluster_researches)) {
|
||||||
tech.progress = this.research[name].contribution
|
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 slave_data of slaves_data) {
|
||||||
for (let [name, tech] of Object.entries(slave_data.meta.research)) {
|
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)) {
|
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.progress = null
|
||||||
tech.researched = 1
|
tech.researched = 1
|
||||||
this.research[name].contribution = 0
|
this.research[name].contribution = 0
|
||||||
|
|||||||
Reference in new issue
Block a user