Skip to content

Commit b2a6c96

Browse files
biharckdannyrb
authored andcommitted
fix: validating whether this.props.layout and prevProps.layout are null or not (#34)
* validating whether this.props.layout and prevProps.layout are null or not * returning true if one of the viewports is undefined * fixing the viewports test when one of them is undefined * fixing the viewports test when one of them is undefined
1 parent 65086fb commit b2a6c96

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/CornerstoneViewport/CornerstoneViewport.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ function initializeTools(cornerstoneTools, tools, element) {
4545
}
4646

4747
function layoutsEqual(a, b) {
48-
if (a.viewports.length !== b.viewports.length) {
48+
if (
49+
!a ||
50+
!b ||
51+
(!a.viewports && !b.viewports) ||
52+
a.viewports.length !== b.viewports.length
53+
) {
4954
return false;
5055
}
5156

0 commit comments

Comments
 (0)