From ae2d439f7d67404590e78d0bb8cf6b858bca7d0c Mon Sep 17 00:00:00 2001 From: emkael Date: Sun, 30 Jul 2017 00:05:58 +0200 Subject: 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 --- Aktywator/Bws.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'Aktywator') 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) { -- cgit v1.2.3