annotorious-v1 icon indicating copy to clipboard operation
annotorious-v1 copied to clipboard

Cannot read property type of undefined

Open dhruvp opened this issue 7 years ago • 2 comments

Hi!

First of all thank you so much for creating and maintaining annotorious for the broader public. It has been a joy to use and has made our lives so much better!

One issue we've been seeing every so often is when we hit edit on an annotation, we get a javascript error in annotorious:

Uncaught TypeError: Cannot read property 'type' of undefined
    at http://127.0.0.1:8080/js/annotorious.min.js:215:107
    at Da (http://127.0.0.1:8080/js/annotorious.min.js:7:92)

I've done my best at understanding why that happens and it seems to me that it corresponds to the code here:

https://github.com/annotorious/annotorious/blob/b3a1db3bf21abccd8b44b3e0c6c2b6479b11b1a9/src/mediatypes/image/image.viewer.js#L245-L248

What's happening is shape is a null object as passed in. This happens because the given shape is for some reason not in self._shapes as in this code snippet:

      self._draw(self._shapes[annotorious.shape.hashCode(annotation.shapes[0])]);

This seems to happen somewhat randomly - most annotations in the same image work but the odd annotation will cause this error.

Would you please be able to help us debug this?

Thank you!

Dhruv

dhruvp avatar Jun 12 '17 23:06 dhruvp