From e34e61345c89d00ba83b3069b4b210188e659e26 Mon Sep 17 00:00:00 2001 From: recall704 Date: Wed, 4 Dec 2019 11:04:28 +0800 Subject: [PATCH] fix mysql output close panic --- pkg/outputs/mysql/mysql.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/outputs/mysql/mysql.go b/pkg/outputs/mysql/mysql.go index c13a2b64..21c2a9bf 100644 --- a/pkg/outputs/mysql/mysql.go +++ b/pkg/outputs/mysql/mysql.go @@ -131,8 +131,12 @@ func (output *MySQLOutput) Start() error { } func (output *MySQLOutput) Close() { - output.db.Close() - output.targetSchemaStore.Close() + if output.db != nil { + output.db.Close() + } + if output.targetSchemaStore != nil { + output.targetSchemaStore.Close() + } } func (output *MySQLOutput) GetRouter() core.Router {