diff --git a/src/VSTOContrib.Core/RibbonFactory/RibbonFactoryController.cs b/src/VSTOContrib.Core/RibbonFactory/RibbonFactoryController.cs index c53275f..a35d8f4 100644 --- a/src/VSTOContrib.Core/RibbonFactory/RibbonFactoryController.cs +++ b/src/VSTOContrib.Core/RibbonFactory/RibbonFactoryController.cs @@ -164,12 +164,12 @@ public void Invoke(IRibbonControl control, Expression caller, params obj { var innerEx = e.InnerException; PreserveStackTrace(innerEx); - if (vstoContribContext.ErrorHandlers.Count == 0) + if (vstoContribContext.ErrorHandlers != null && vstoContribContext.ErrorHandlers.Count == 0) { Trace.TraceError(innerEx.ToString()); } - var handled = vstoContribContext.ErrorHandlers.Any(errorHandler => errorHandler.Handle(innerEx)); + var handled = vstoContribContext.ErrorHandlers != null && vstoContribContext.ErrorHandlers.Any(errorHandler => errorHandler.Handle(innerEx)); if (!handled) throw innerEx; @@ -213,4 +213,4 @@ public void Dispose() customTaskPaneRegister.Dispose(); } } -} \ No newline at end of file +}