mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-25 08:23:13 +09:00
Fixed null value parsing
This commit is contained in:
1 parent
eb3b7df390
commit
834fc8cf98
1 file changed
+13
-7
+13
-7
@@ -168,27 +168,33 @@ masterConfigCommands.add(new libCommand.Command({
|
|||||||
for (let index in filtered) {
|
for (let index in filtered) {
|
||||||
if (index in filtered) {
|
if (index in filtered) {
|
||||||
filtered[index] = filtered[index].split("=");
|
filtered[index] = filtered[index].split("=");
|
||||||
|
let finalIndex = filtered[index][0].trim();
|
||||||
// split on the = we added earlier
|
// split on the = we added earlier
|
||||||
let part = "";
|
let part = "";
|
||||||
try {
|
try {
|
||||||
part = filtered[index][1].trim();
|
part = filtered[index][1].trim();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
part = null;
|
part = "";
|
||||||
}
|
}
|
||||||
if (part === "null") {
|
if (part === "null") {
|
||||||
part = null;
|
print(`Warning: ${finalIndex} has been set to the value null, not the string "null".`);
|
||||||
|
part = "";
|
||||||
}
|
}
|
||||||
let finalIndex = filtered[index][0].trim();
|
|
||||||
final[finalIndex] = part;
|
final[finalIndex] = part;
|
||||||
// trim whitespace and put in final array for processing
|
// trim whitespace and put in final array for processing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let element in final) {
|
for (let element in final) {
|
||||||
if (element in final) {
|
if (element in final) {
|
||||||
await libLink.messages.setMasterConfigField.send(control, {
|
try {
|
||||||
field: element,
|
await libLink.messages.setMasterConfigField.send(control, {
|
||||||
value: final[element],
|
field: element,
|
||||||
});
|
value: final[element],
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
// eslint-disable-next-line
|
||||||
|
print(`Attempt to set ${element} to ${final[element] || String(null)} failed; set back to previous value.`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
emmiter.emit("dot_on_done");
|
emmiter.emit("dot_on_done");
|
||||||
|
|||||||
Reference in new issue
Block a user