Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid image URL when loadFromJSON causes inconsistency #2796

Closed
pedrofs opened this issue Feb 17, 2016 · 0 comments · Fixed by #2878
Closed

Invalid image URL when loadFromJSON causes inconsistency #2796

pedrofs opened this issue Feb 17, 2016 · 0 comments · Fixed by #2878

Comments

@pedrofs
Copy link

pedrofs commented Feb 17, 2016

Hey guys,

I'm loading a canvas from JSON. The scenario I have here is simple: One of the images has a broken link.

It causes this specific object to have _element property and _originalElement property to be null and then when I try to JSON.stringify(canvas) it raises an error:

Uncaught TypeError: Cannot read property 'src' of null. fabric.Image.fabric.util.createClass.toObject @ fabric.js:17106

Looking at this line I can see:

src: this._originalElement.src || this._originalElement._src,

For now I'll check after loading the canvas for every image without this properties properly set and try to remove them but I think we should somehow avoid this inconsistency.

Do you have any thoughts?

Thanks and best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants