File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ public static IServiceCollection AddMqttControllers(this IServiceCollection serv
5656
5757 services . AddSingleton < ITypeActivatorCache > ( new TypeActivatorCache ( ) ) ;
5858 services . AddSingleton < MqttRouter > ( ) ;
59- if ( _opt . RouteInvocationInterceptor = = null )
59+ if ( _opt . RouteInvocationInterceptor ! = null )
6060 {
6161 services . AddSingleton ( typeof ( IRouteInvocationInterceptor ) , _opt . RouteInvocationInterceptor ) ;
6262 }
@@ -101,15 +101,21 @@ public static IApplicationBuilder UseAttributeRouting(this IApplicationBuilder a
101101 var interceptor = app . ApplicationServices . GetService < IRouteInvocationInterceptor > ( ) ;
102102 server . InterceptingPublishAsync += async ( args ) =>
103103 {
104- await interceptor ? . RouteExecuting ( args . ClientId , args . ApplicationMessage ) ;
104+ if ( interceptor != null )
105+ {
106+ await interceptor . RouteExecuting ( args . ClientId , args . ApplicationMessage ) ;
107+ }
105108 try
106109 {
107110 await router . OnIncomingApplicationMessage ( app . ApplicationServices , args , allowUnmatchedRoutes ) ;
108111 }
109112 catch ( Exception ex )
110113 {
111- await interceptor ? . RouteExecuted ( args , ex ) ;
112- if ( interceptor == null )
114+ if ( interceptor != null )
115+ {
116+ await interceptor . RouteExecuted ( args , ex ) ;
117+ }
118+ else
113119 {
114120 throw ;
115121 }
You can’t perform that action at this time.
0 commit comments