         @setEmbedImageIndex @getEmbedImageIndex() - 1
         @$("a.preview_link_switch.next").removeClass "disabled"
 
-      @getDelegate().embedImage.setSrc @getData().link_embed?.images?[@getEmbedImageIndex()]?.url
-      @getDelegate().getDelegate().setEmbedImageIndex @getEmbedImageIndex()
+
+      if @getEmbedImageIndex() < @getData().link_embed?.images.length-1
+        @getDelegate().embedImage.setSrc @getData().link_embed?.images?[@getEmbedImageIndex()]?.url
+        @getDelegate().getDelegate().setEmbedImageIndex @getEmbedImageIndex()
+      else
+        # imageindex out of bounds - displaying default image (first in the images array)
+        @getDelegate().embedImage.setSrc @getData().link_embed?.images?[0]?.url
+
+
       # @$("div.preview_image img.thumb").attr src : @getData().link_embed?.images?[@getEmbedImageIndex()]?.url
       @$("span.thumb_nr").html @getEmbedImageIndex()+1
 

    super options,data
    @hide() if (data?.link_embed_hidden_items?["image"]?) or  (data.link_embed?.images?.length is 0)

  setSrc:(url)->
    @$("img.thumb").attr src : url

  viewAppended:->
    super()
    @setTemplate @pistachio()
    @template.update()

  pistachio:->
    """
    <a class="preview_link" target="_blank" href="#{@getData().link_url or @getData().link_embed?.url}">
      <img class="thumb" src="#{@getData().link_embed?.images?[@getData().link_embed_image_index]?.url or "this needs a default url"}" title="#{(@getData().link_embed?.title + (if @getData().link_embed?.author_name then " by "+@getData().link_embed?.author_name else "")) or "untitled"}"/>
    </a>
    """


  click:(event)=>
    if  $(event.target).hasClass "preview_link_switch"

      event.preventDefault()
      event.stopPropagation()

      if ($(event.target).hasClass "next") and (@getData().link_embed?.images?.length-1 > @getEmbedImageIndex() )
        @setEmbedImageIndex @getEmbedImageIndex() + 1
        @$("a.preview_link_switch.previous").removeClass "disabled"
