fix javascript error when previewImages is set to false
Merge pull request #340 from cykus/master

fix javascript error when previewImages is set to false