From 676ec839acbf49afbc9ac99d6ad421b1298e9bad Mon Sep 17 00:00:00 2001 From: cuqmbr Date: Thu, 11 Aug 2022 13:57:13 +0300 Subject: [PATCH] fix: fix 'new name' prompt when passing empty string This fixes System.UnauthorizedAccessException by prompting new name again --- netxml2kml/Program.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/netxml2kml/Program.cs b/netxml2kml/Program.cs index b2c3801..af0d82d 100644 --- a/netxml2kml/Program.cs +++ b/netxml2kml/Program.cs @@ -80,8 +80,14 @@ class Program if (String.IsNullOrEmpty(opt) || opt.ToLower() == "no" || opt.ToLower() == "n") { - Console.Write("Enter a new name: "); + Console.Write("Enter a [.kml]: "); var name = Console.ReadLine(); + + if (String.IsNullOrEmpty(name)) + { + continue; + } + outFile = new FileInfo( Path.Join(outFile.DirectoryName, name)); continue;