From: Jérémie Laval Date: Mon, 17 Dec 2012 18:54:21 +0000 (+0100) Subject: [monkeydoc] Protect GetIndex and GetSearchIndex and make them returns null if somethi... X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=914875b9966435427e943bd2f553a4b63d086851;p=mono.git [monkeydoc] Protect GetIndex and GetSearchIndex and make them returns null if somethings goes wrong. --- diff --git a/mcs/tools/monkeydoc/Monkeydoc/RootTree.cs b/mcs/tools/monkeydoc/Monkeydoc/RootTree.cs index b2913fd19e0..799ed9514f6 100644 --- a/mcs/tools/monkeydoc/Monkeydoc/RootTree.cs +++ b/mcs/tools/monkeydoc/Monkeydoc/RootTree.cs @@ -404,12 +404,16 @@ namespace MonkeyDoc public IndexReader GetIndex () { - string text = Path.Combine (this.basedir, "monodoc.index"); - if (File.Exists (text)) - return IndexReader.Load (text); + try { + string text = Path.Combine (this.basedir, "monodoc.index"); + if (File.Exists (text)) + return IndexReader.Load (text); - text = Path.Combine (Settings.Get ("monodocIndexDirectory"), "monodoc.index"); - return IndexReader.Load (text); + text = Path.Combine (Settings.Get ("monodocIndexDirectory"), "monodoc.index"); + return IndexReader.Load (text); + } catch { + return null; + } } public static void MakeIndex () @@ -443,12 +447,15 @@ namespace MonkeyDoc public SearchableIndex GetSearchIndex () { - string text = Path.Combine (this.basedir, "search_index"); - if (System.IO.Directory.Exists (text)) { + try { + string text = Path.Combine (this.basedir, "search_index"); + if (System.IO.Directory.Exists (text)) + return SearchableIndex.Load (text); + text = Path.Combine (Settings.Get ("docPath"), "search_index"); return SearchableIndex.Load (text); + } catch { + return null; } - text = Path.Combine (Settings.Get ("docDir"), "search_index"); - return SearchableIndex.Load (text); } public static void MakeSearchIndex ()