diff --git a/server/modules/monitor/mysql_mon.c b/server/modules/monitor/mysql_mon.c index decbccc57..957866b30 100644 --- a/server/modules/monitor/mysql_mon.c +++ b/server/modules/monitor/mysql_mon.c @@ -878,6 +878,13 @@ static void set_master_heartbeat(MYSQL_MONITOR *handle, MONITOR_SERVERS *databas char heartbeat_insert_query[512]=""; char heartbeat_purge_query[512]=""; + if (handle->master == NULL) { + LOGIF(LE, (skygw_log_write_flush( + LOGFILE_ERROR, + "[mysql_mon]: set_master_heartbeat called without an available Master server"))); + return; + } + /* create the maxscale_schema database */ if (mysql_query(database->con, "CREATE DATABASE IF NOT EXISTS maxscale_schema")) { LOGIF(LE, (skygw_log_write_flush( @@ -983,6 +990,13 @@ static void set_slave_heartbeat(MYSQL_MONITOR *handle, MONITOR_SERVERS *database MYSQL_RES *result; int num_fields; + if (handle->master == NULL) { + LOGIF(LE, (skygw_log_write_flush( + LOGFILE_ERROR, + "[mysql_mon]: set_slave_heartbeat called without an available Master server"))); + return; + } + /* Get the master_timestamp value from maxscale_schema.replication_heartbeat table */ sprintf(select_heartbeat_query, "SELECT master_timestamp "