Fix possible NPE when loading thumbnails (see #11879)
Merge pull request #1947 from jburel/npe-thumbnails

NPE Thumbnails