Handle if new node is added with no nearby systems

This commit is contained in:
Logan Cusano
2023-06-18 19:06:14 -04:00
parent 8dffeccf83
commit 7a040a8e97

View File

@@ -136,7 +136,7 @@ exports.addNewNode = async (nodeObject, callback) => {
ip = nodeObject.ip,
port = nodeObject.port,
location = nodeObject.location,
nearbySystems = utils.JsonToBuffer(nodeObject.nearbySystems),
nearbySystems = utils.JsonToBuffer(nodeObject.nearbySystems ?? {}),
online = nodeObject.online
const sqlQuery = `INSERT INTO ${nodesTable} (name, ip, port, location, nearbySystems, online) VALUES ('${name}', '${ip}', ${port}, '${location}', '${nearbySystems}', ${online})`;