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
56
56
57
57
services . AddSingleton < ITypeActivatorCache > ( new TypeActivatorCache ( ) ) ;
58
58
services . AddSingleton < MqttRouter > ( ) ;
59
- if ( _opt . RouteInvocationInterceptor = = null )
59
+ if ( _opt . RouteInvocationInterceptor ! = null )
60
60
{
61
61
services . AddSingleton ( typeof ( IRouteInvocationInterceptor ) , _opt . RouteInvocationInterceptor ) ;
62
62
}
@@ -101,15 +101,21 @@ public static IApplicationBuilder UseAttributeRouting(this IApplicationBuilder a
101
101
var interceptor = app . ApplicationServices . GetService < IRouteInvocationInterceptor > ( ) ;
102
102
server . InterceptingPublishAsync += async ( args ) =>
103
103
{
104
- await interceptor ? . RouteExecuting ( args . ClientId , args . ApplicationMessage ) ;
104
+ if ( interceptor != null )
105
+ {
106
+ await interceptor . RouteExecuting ( args . ClientId , args . ApplicationMessage ) ;
107
+ }
105
108
try
106
109
{
107
110
await router . OnIncomingApplicationMessage ( app . ApplicationServices , args , allowUnmatchedRoutes ) ;
108
111
}
109
112
catch ( Exception ex )
110
113
{
111
- await interceptor ? . RouteExecuted ( args , ex ) ;
112
- if ( interceptor == null )
114
+ if ( interceptor != null )
115
+ {
116
+ await interceptor . RouteExecuted ( args , ex ) ;
117
+ }
118
+ else
113
119
{
114
120
throw ;
115
121
}
You can’t perform that action at this time.
0 commit comments