NPE in ImageUtils.createThumbnailFromUri

Fix #1844 and #1848