diff --git a/Packages/ohif-measurements/client/lib/MeasurementHandlers.js b/Packages/ohif-measurements/client/lib/MeasurementHandlers.js index a8c4c076b..c2656cb14 100644 --- a/Packages/ohif-measurements/client/lib/MeasurementHandlers.js +++ b/Packages/ohif-measurements/client/lib/MeasurementHandlers.js @@ -10,7 +10,7 @@ class MeasurementHandlers { const measurementData = eventData.measurementData; const Collection = measurementApi.tools[eventData.toolType]; - // Stop here if the tool data shall not be stored (e.g. temp tools) + // Stop here if the tool data shall not be persisted (e.g. temp tools) if (!Collection) { return; } @@ -79,7 +79,7 @@ class MeasurementHandlers { const measurementData = eventData.measurementData; const Collection = measurementApi.tools[eventData.toolType]; - // Stop here if the tool data shall not be stored (e.g. temp tools) + // Stop here if the tool data shall not be persisted (e.g. temp tools) if (!Collection) { return; } @@ -121,9 +121,15 @@ class MeasurementHandlers { const measurementData = eventData.measurementData; const measurementNumber = measurementData.measurementNumber; const { measurementApi, timepointApi } = instance.data; - const collection = measurementApi.tools[eventData.toolType]; + const Collection = measurementApi.tools[eventData.toolType]; + + // Stop here if the tool data shall not be persisted (e.g. temp tools) + if (!Collection) { + return; + } + const measurementTypeId = measurementApi.toolsGroupsMap[measurementData.toolType]; - const measurement = collection.findOne(measurementData._id); + const measurement = Collection.findOne(measurementData._id); const timepointId = measurement.timepointId; // Remove all the measurements with the given type and number