@@ -265,21 +265,24 @@ private ExecutionResult executeThumbnailers(String useMimeType, File input, File
265265 ExecutionResult result = ExecutionResult .failed (
266266 new ThumbnailException ("No suitable Thumbnailer has been " + "found for: " + input .getName ()));
267267
268- for (Thumbnailer thumbnailer : thumbnailers .get (useMimeType )) {
269- try {
270- if (thumbnailer instanceof ThumbnailerManager ) continue ;
271- thumbnailer .generateThumbnail (input , output , detectedMimeType );
272- result = ExecutionResult .success ();
273- return result ;
274- } catch (ThumbnailRuntimeException e ) {
275- log .warn ("pass runtime error to Thumbnailer" );
276- result = ExecutionResult .failed (e );
277- } catch (ThumbnailException | IOException e ) {
278- // This Thumbnailer apparently wasn't suitable, so try next
279- result = ExecutionResult .failed (e );
280- } catch (Exception e ) {
281- log .error ("unknown exception occurred!" );
282- result = ExecutionResult .failed (e );
268+ var thumbnailerList = thumbnailers .get (useMimeType );
269+ if (thumbnailerList != null ) {
270+ for (Thumbnailer thumbnailer : thumbnailerList ) {
271+ try {
272+ if (thumbnailer instanceof ThumbnailerManager ) continue ;
273+ thumbnailer .generateThumbnail (input , output , detectedMimeType );
274+ result = ExecutionResult .success ();
275+ return result ;
276+ } catch (ThumbnailRuntimeException e ) {
277+ log .warn ("pass runtime error to Thumbnailer" );
278+ result = ExecutionResult .failed (e );
279+ } catch (ThumbnailException | IOException e ) {
280+ // This Thumbnailer apparently wasn't suitable, so try next
281+ result = ExecutionResult .failed (e );
282+ } catch (Exception e ) {
283+ log .error ("unknown exception occurred!" );
284+ result = ExecutionResult .failed (e );
285+ }
283286 }
284287 }
285288 return result ;
0 commit comments