From 8d1d3eb1bc63343b64dfdd6c9b00c2ca3df21d58 Mon Sep 17 00:00:00 2001 From: Maarten van Stam Date: Tue, 10 Mar 2015 13:43:27 +0100 Subject: [PATCH] Update RibbonFactoryController.cs Ran into situation where vstoContribContext.ErrorHandlers was null, throwing another exception ... Added check for vstoContribContext.ErrorHandlers != null --- .../RibbonFactory/RibbonFactoryController.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 +}