From b2cfb4eea906c3f048393490ebe2a1ef8aa54862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Jaramago=20Fern=C3=A1ndez?= Date: Mon, 14 Mar 2022 11:14:23 +0100 Subject: [PATCH] Fix crash when 'gtid_executed' is empty --- lib/MySQL_HostGroups_Manager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/MySQL_HostGroups_Manager.cpp b/lib/MySQL_HostGroups_Manager.cpp index 180c7e4dd..0a86f0105 100644 --- a/lib/MySQL_HostGroups_Manager.cpp +++ b/lib/MySQL_HostGroups_Manager.cpp @@ -572,7 +572,10 @@ std::string gtid_executed_to_string(gtid_set_t& gtid_executed) { gtid_set = gtid_set + s2; } } - gtid_set.pop_back(); + // Extract latest comma only in case 'gtid_executed' isn't empty + if (gtid_set.empty() == false) { + gtid_set.pop_back(); + } return gtid_set; }