File tree Expand file tree Collapse file tree
src/MediaConverters/MediaConverters.Tool Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,7 +105,9 @@ internal static async Task<ErrorCode> RunAsync(ConvertHandler convertHandler)
105105 context . LogMessage ( $ "[Performance] OptimizeImageFileAsync cost { stepStopwatch . ElapsedMilliseconds } ms Total { totalStopwatch . ElapsedMilliseconds } ms") ;
106106 stepStopwatch . Restart ( ) ;
107107
108- if ( ! imageFileOptimizationResult . IsSuccess )
108+ var image = imageFileOptimizationResult . Image ;
109+
110+ if ( ! imageFileOptimizationResult . IsSuccess || image is null )
109111 {
110112 var errorMessage = $ "Failed to convert image file '{ inputFile . FullName } '. Reason: { imageFileOptimizationResult . FailureReason } ";
111113 if ( imageFileOptimizationResult . Exception is { } exception )
@@ -138,10 +140,8 @@ internal static async Task<ErrorCode> RunAsync(ConvertHandler convertHandler)
138140
139141 return ErrorCode . UnknownError ;
140142 }
141-
142- var image = imageFileOptimizationResult . Image ;
143143
144- if ( image is not null && imageConvertContext . ImageConvertTaskList is { } list )
144+ if ( imageConvertContext . ImageConvertTaskList is { } list )
145145 {
146146 var workerProvider = new WorkerProvider ( ) ;
147147
You can’t perform that action at this time.
0 commit comments