Browse Source

Added conditional exceptions.

BDisp 5 years ago
parent
commit
2c8f6ec175
1 changed files with 12 additions and 2 deletions
  1. 12 2
      Terminal.Gui/Windows/FileDialog.cs

+ 12 - 2
Terminal.Gui/Windows/FileDialog.cs

@@ -57,8 +57,18 @@ namespace Terminal.Gui {
 				top = 0;
 				selected = 0;
 				valid = true;
-			} catch (Exception) {
-				valid = false;
+			} catch (Exception ex) {
+				switch (ex) {
+				case DirectoryNotFoundException _:
+				case ArgumentException _:
+					dirInfo = null;
+					infos.Clear ();
+					valid = true;
+					break;
+				default:
+					valid = false;
+					break;
+				}
 			} finally {
 				if (valid) {
 					SetNeedsDisplay ();