Check if there is a connection before release

Fixes #885
This commit is contained in:
Ben Hardill 2022-02-21 10:09:29 +00:00
parent 919732fac1
commit d701d46635
No known key found for this signature in database
GPG Key ID: 74DD076979ABB1E7

View File

@ -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);