From 261d4ced8689603cc0508a28a51ac5c2c1c13375 Mon Sep 17 00:00:00 2001
From: "p.shestakov"
Date: Sun, 24 Mar 2024 10:53:52 +0200
Subject: [PATCH] fixed bug while clicking 'Connect' button w/o properly value
in 'filename' field
---
LiteDB.Studio/Forms/ConnectionForm.cs | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/LiteDB.Studio/Forms/ConnectionForm.cs b/LiteDB.Studio/Forms/ConnectionForm.cs
index 2f9640d..900c090 100644
--- a/LiteDB.Studio/Forms/ConnectionForm.cs
+++ b/LiteDB.Studio/Forms/ConnectionForm.cs
@@ -51,6 +51,12 @@ public ConnectionForm(ConnectionString cs)
private void BtnConnect_Click(object sender, EventArgs e)
{
+ if (!AppSettingsManager.IsDbExist(txtFilename.Text))
+ {
+ MessageBox.Show($"Field {groupBox2.Text} should contains valid path to database file, please check it out.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ return;
+ }
+
this.ConnectionString.Connection =
radModeDirect.Checked ? ConnectionType.Direct :
radModeShared.Checked ? ConnectionType.Shared : ConnectionType.Direct;