From 87e50f2b764c19628e27574a22b1b5674eddc655 Mon Sep 17 00:00:00 2001 From: Ben Hardill Date: Mon, 21 Feb 2022 20:08:33 +0000 Subject: [PATCH] Mysql fix (#886) * Check if there is a connection before release Fixes #885 --- storage/mysql/68-mysql.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/storage/mysql/68-mysql.js b/storage/mysql/68-mysql.js index 984be193..0cc17347 100644 --- a/storage/mysql/68-mysql.js +++ b/storage/mysql/68-mysql.js @@ -114,7 +114,9 @@ module.exports = function(RED) { //console.log("query:",msg.topic); node.mydbConfig.pool.getConnection(function (err, conn) { if (err) { - conn.release() + if (conn) { + conn.release() + } status = { fill: "red", shape: "ring", text: RED._("mysql.status.error") + ": " + err.code }; node.status(status); node.error(err, msg);