From 2fe6fd326c67b00663f12da2c2e0dc7c1f2432df Mon Sep 17 00:00:00 2001 From: Jonathan Pobst Date: Wed, 16 Jan 2008 19:12:33 +0000 Subject: [PATCH] 2008-01-16 Jonathan Pobst * FolderBrowserDialog.cs: If we cannot interpret the user's requested SelectedPath, just display the default dialog instead of crashing. [Fixes bug #348989] svn path=/trunk/mcs/; revision=93082 --- .../System.Windows.Forms/ChangeLog | 6 ++++++ .../System.Windows.Forms/FolderBrowserDialog.cs | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog index 16d778d9c45..d60fc590ebb 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog @@ -1,3 +1,9 @@ +2008-01-16 Jonathan Pobst + + * FolderBrowserDialog.cs: If we cannot interpret the user's requested + SelectedPath, just display the default dialog instead of crashing. + [Fixes bug #348989] + 2008-01-16 Geoff Norton * XplatUICarbon.cs: Avoid some unecessary invalidation calls when diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs index 5545402dbc8..b059589ac8b 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FolderBrowserDialog.cs @@ -384,8 +384,14 @@ namespace System.Windows.Forms { if (!Path.IsPathRooted (value)) return; - if (Check_if_path_is_child_of_RootFolder (value)) { - SetSelectedPath (Path.GetFullPath (value)); + try { + if (Check_if_path_is_child_of_RootFolder (value)) + SetSelectedPath (Path.GetFullPath (value)); + } catch (Exception) { + // If we can't set the user's requested path, the + // best we can do is not crash and reset to the default + EndUpdate (); + RootFolder = rootFolder; } } } -- 2.25.1