fsharp/fsharpbinding — pull request #35 by bojanrajkovic (2012-10-23 21:27:04+00:00)
Title: Fixes a NullReferenceException when the binding was instantiated from mdtool

When building from the command line, mdtool is sometimes used (ie. for projects that don't have MSBuild targets—examples include MonoTouch, MonoMac, etc.). In the case where the FSharpLanguageBinding was instantiated from this context, it would try to access `IdeApp.Workbench`, which is null (there is no workbench), causing a NullReferenceException and making mdtool not usable for builds.

This PR fixes that by wrapping references to `IdeApp.Workbench` in a check for `IdeApp.IsInitialized` which will be false if and only if the current context is mdtool or some similar non-UI tool. In the normal case, `IdeApp.IsInitialized` will be true and this won't be an issue.