From eed5f241b469b6a2ca862cb6e2064509b7055907 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 19 Jul 2018 05:02:33 +1000 Subject: [PATCH] fix prev --- MCGalaxy/Database/Backends/SQLite3.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/MCGalaxy/Database/Backends/SQLite3.cs b/MCGalaxy/Database/Backends/SQLite3.cs index 06c56edc9..c453027bc 100644 --- a/MCGalaxy/Database/Backends/SQLite3.cs +++ b/MCGalaxy/Database/Backends/SQLite3.cs @@ -358,7 +358,6 @@ namespace System.Data.SQLite { public sealed class SQLiteCommand : IDbCommand { string strCmdText, strRemaining; - SQLiteConnection conn; SQLiteParameterCollection parameters = new SQLiteParameterCollection(); SQLiteStatement stmt; @@ -369,25 +368,27 @@ namespace System.Data.SQLite { if (connection != null) Connection = connection; } + void DisposeStatement() { + if (stmt != null) stmt.Dispose(); + stmt = null; + } + public void Dispose() { conn = null; parameters.Clear(); strCmdText = null; strRemaining = null; - - if (stmt != null) stmt.Dispose(); - stmt = null; + DisposeStatement(); } internal SQLiteStatement NextStatement() { - if (stmt != null) stmt.Dispose(); + if (stmt != null) DisposeStatement(); if (String.IsNullOrEmpty(strRemaining)) return null; - stmt = null; try { stmt = conn.Prepare(strRemaining, ref strRemaining); } catch (Exception) { - if (stmt != null) { stmt.Dispose(); stmt = null; } + DisposeStatement(); // Cannot continue on, so set the remaining text to null. strRemaining = null; throw;