Closing the viewer object causes and error when there is an overlay created for that viewer. When the close() method is called it eventually generates a resize event that is handled by the canvas overlay object. Inside that event handler, it attempts to get the image via a call to viewer.world.getItemAt(0). Then is attempts to use that image object to get the dimensions of the image. However, because the viewer has been closed the image(s) have already been removed and the viewer.world.getItemAt(0) routine returns null.
Closing the viewer object causes and error when there is an overlay created for that viewer. When the close() method is called it eventually generates a resize event that is handled by the canvas overlay object. Inside that event handler, it attempts to get the image via a call to viewer.world.getItemAt(0). Then is attempts to use that image object to get the dimensions of the image. However, because the viewer has been closed the image(s) have already been removed and the viewer.world.getItemAt(0) routine returns null.