diff --git a/packages/react-devtools-shared/src/backend/legacy/renderer.js b/packages/react-devtools-shared/src/backend/legacy/renderer.js index 2d7e9df0ed3cb..547901d4b72c6 100644 --- a/packages/react-devtools-shared/src/backend/legacy/renderer.js +++ b/packages/react-devtools-shared/src/backend/legacy/renderer.js @@ -165,7 +165,7 @@ export function attach( } function getID(internalInstance: InternalInstance): number { - if (typeof internalInstance !== 'object') { + if (typeof internalInstance !== 'object' || internalInstance === null) { throw new Error('Invalid internal instance: ' + internalInstance); } if (!internalInstanceToIDMap.has(internalInstance)) {