Skip to content

Commit

Permalink
Catch exception in pad initialization. Fixes #207
Browse files Browse the repository at this point in the history
  • Loading branch information
nosami committed Apr 2, 2018
1 parent f404023 commit 4031a6b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion XSVim/Properties/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open System.Runtime.CompilerServices
[<AutoOpen>]
module AddinVersion =
[<Literal>]
let version = "0.50.1"
let version = "0.50.2"

[<assembly: AssemblyTitle("XSVim")>]
[<assembly: AssemblyDescription("")>]
Expand Down
15 changes: 10 additions & 5 deletions XSVim/TreeViewPads.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
open System
open Gtk
open MonoDevelop.Ide
open MonoDevelop.Ide.Gui
open MonoDevelop.Ide.Gui.Components
open MonoDevelop.Ide.Gui.Pads
open Reflection
Expand All @@ -14,10 +13,16 @@ module treeViewPads =
| Some workbench ->
workbench.Pads
|> List.ofSeq
|> List.map(fun pad -> pad.Content)
|> List.filter(fun pad -> pad :? TreeViewPad)
|> Seq.cast<TreeViewPad>
| None -> Seq.empty
|> List.choose(fun pad ->
try
// fetching pad.Content can throw when there is an exception
// when initializing the pad
match pad.Content with
| :? TreeViewPad as pad -> Some pad
| _ -> None
with
| _ -> None)
| None -> List.empty

let select (tree:TreeView) (iter:TreeIter ref) =
tree.Selection.UnselectAll()
Expand Down

0 comments on commit 4031a6b

Please sign in to comment.