Fix access to the first element of an empty list

Avoid message "Error while downloading image" upon synchronization
when image caching is enabled.
Merge pull request #294 from nivalis/master

Avoid message "Error while downloading image" upon synchronization when image caching is enabled.