summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-07-30 00:05:58 +0200
committeremkael <emkael@tlen.pl>2017-07-30 00:05:58 +0200
commitae2d439f7d67404590e78d0bb8cf6b858bca7d0c (patch)
tree712a2ce5b3d724ee10fe74d9f9229abae057bed4
parentdaeb4826264484305141f443f37df7e6ba9ac6e9 (diff)
Fixed control flow on names sync abort - MySQL data reader was not closed properly if user chose not to continue syncing on first warning.
Also, the same choice (Continue? Yes/No) is offered on any other MySQL error
-rw-r--r--Aktywator/Bws.cs18
1 files changed, 12 insertions, 6 deletions
diff --git a/Aktywator/Bws.cs b/Aktywator/Bws.cs
index 4a7ec16..6a3b394 100644
--- a/Aktywator/Bws.cs
+++ b/Aktywator/Bws.cs
@@ -396,6 +396,8 @@ namespace Aktywator
}
mydata n = tournament.mysql.select(query.ToString());
+ DialogResult dr = DialogResult.None;
+
try
{
n.Read();
@@ -424,23 +426,27 @@ namespace Aktywator
{
if (ee.ErrorCode == -2147467259)
{
- DialogResult dr = MessageBox.Show("W bws-ie jest para/team (" + ns + " albo " + ew
+ dr = MessageBox.Show("W bws-ie jest para/team (" + ns + " albo " + ew
+ "), który nie istnieje w wybranym turnieju. Może to nie ten turniej?"
+ "\n\n" + "Kontynuować wczytywanie?",
"Zły turniej", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
- if (dr == DialogResult.No) return;
}
else
{
- MessageBox.Show(ee.Message, "Błąd MySQL", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Warning);
+ dr = MessageBox.Show(ee.Message + "\n\n" + "Kontynuować?",
+ "Błąd MySQL", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
}
}
}
- try
+ finally
{
- n.Close();
+ try
+ {
+ n.Close();
+ }
+ catch (Exception) { }
}
- catch (Exception) { }
+ if (dr == DialogResult.No) break;
}
if (interactive)
{