fix: swallow update-image error for "clicking annotation arrows"; as doing _nothing_ if the image isn't loaded yet is perfectly okay (#2076)

This commit is contained in:
Danny Brown 2020-10-01 22:08:51 -04:00 committed by GitHub
parent 0da451c26a
commit 4ae848761d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,6 +27,13 @@ export default function setMeasurementActive(measurement) {
const enabledElements = cornerstoneTools.store.state.enabledElements;
enabledElements.forEach(element => {
cornerstone.updateImage(element);
try {
cornerstone.updateImage(element);
} catch (ex) {
// https://github.com/cornerstonejs/cornerstone/blob/master/src/updateImage.js#L16
// This fails if enabledElement.image is undefined and we have no layers
// Instead of throwing, it should _probably_ do nothing.
// We'll just swallow the exception
}
});
}