From cb2a6055a498c92db7128f0f4c939d5675c32e33 Mon Sep 17 00:00:00 2001
From: croire <1432593898@qq.com>
Date: Sun, 27 Mar 2022 23:15:00 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0null=E5=88=A4=E6=96=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
DownKyi.Core/Storage/Database/DbHelper.cs | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/DownKyi.Core/Storage/Database/DbHelper.cs b/DownKyi.Core/Storage/Database/DbHelper.cs
index 56b4c57..a2e753f 100644
--- a/DownKyi.Core/Storage/Database/DbHelper.cs
+++ b/DownKyi.Core/Storage/Database/DbHelper.cs
@@ -72,6 +72,8 @@ namespace DownKyi.Core.Storage.Database
///
public void Open()
{
+ if (conn == null) { return; }
+
if (!IsOpen())
{
conn.Open();
@@ -83,6 +85,8 @@ namespace DownKyi.Core.Storage.Database
///
public void Close()
{
+ if (conn == null) { return; }
+
if (IsOpen())
{
conn.Close();
@@ -97,6 +101,8 @@ namespace DownKyi.Core.Storage.Database
///
public void ExecuteNonQuery(string sql, Action action = null)
{
+ if (conn == null) { return; }
+
try
{
lock (conn)
@@ -129,6 +135,8 @@ namespace DownKyi.Core.Storage.Database
///
public void ExecuteQuery(string sql, Action action)
{
+ if (conn == null) { return; }
+
try
{
lock (conn)