From 0bd5debabf694b7ad55127c1096c4d6d45aa6a1f Mon Sep 17 00:00:00 2001 From: 34Ninjas <34Ninjas@DESKTOP-J639PDB> Date: Sun, 24 Apr 2016 18:41:25 +0200 Subject: [PATCH] Fixed crash after closing open dialog --- ProgramListv2/Form/Form2.vb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ProgramListv2/Form/Form2.vb b/ProgramListv2/Form/Form2.vb index ada6ab3..e8f030e 100644 --- a/ProgramListv2/Form/Form2.vb +++ b/ProgramListv2/Form/Form2.vb @@ -138,16 +138,18 @@ Me.WindowState = FormWindowState.Minimized OpenFileDialog.ShowDialog() Me.WindowState = FormWindowState.Normal - TextBoxPath.Text = OpenFileDialog.FileName - If TextBoxName.Text = "" Or TextBoxName.Text = TextBoxNameDefault Then + Dim fn As String - Dim fn As String - fn = OpenFileDialog.SafeFileName + fn = OpenFileDialog.SafeFileName - TextBoxName.Text = fn.Substring(0, Convert.ToInt32(fn.LastIndexOf("."))) + If OpenFileDialog.FileName.Length > 0 Then + TextBoxPath.Text = OpenFileDialog.FileName + End If + If TextBoxName.Text = "" Or TextBoxName.Text = TextBoxNameDefault And fn.Length > 0 Then + TextBoxName.Text = fn.Substring(0, Convert.ToInt32(fn.LastIndexOf("."))) End If -- 2.51.2