Skip to content

Empty src causes component crash #36

@MichalBryxi

Description

@MichalBryxi

Steps to reproduce:

  1. Take sample photoswipe code.
  2. Set src of some property for the gallery to empty string (anything that does not resolve to image will do).
  3. Display the gallery in browser and click on the image to enlarge it.
  4. Observe that there is error in console.

Sample data:

  moo: [
  {
    src: 'http://placekitten.com/g/600/400',
    w: 600,
    h: 400,
    title: 'whooa',
    msrc: '(optional) larger image'
  },
  {
    src: '',
    w: 600,
    h: 400,
    title: 'whooa',
    msrc: '(optional) larger image'
  }
]

With that data I get following error:

ember.debug.js:16591 Uncaught Error: Assertion Failed: You must use Ember.set() to set the `h` property (of [object Object]) to `0`.

and following stack trace.

I found the line in photoswipe source which causes this.

In general, I think ember-cli-photoswipe should pass only plain JSON objects to photoswipe library, because there might be also other cases in which photoswipe changes input data and thus makes EmberJS freak out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions