Fix NPE in DataDescription

Summary: Fixed NPE found during exploratory testing Layout Inspector

Reviewed By: nikoant

Differential Revision: D24783042

fbshipit-source-id: 38d76d677941bcfe8ecfa2e165ed4ea421c32edf
This commit is contained in:
Michel Weststrate
2020-11-06 05:45:04 -08:00
committed by Facebook GitHub Bot
parent e92145d2fd
commit b8b9c4296a

View File

@@ -718,7 +718,7 @@ class DataDescriptionContainer extends PureComponent<{
case 'array':
return val.length <= 0 ? <EmptyObjectValue>[]</EmptyObjectValue> : null;
case 'object':
return Object.keys(val).length <= 0 ? (
return Object.keys(val ?? {}).length <= 0 ? (
<EmptyObjectValue>{'{}'}</EmptyObjectValue>
) : null;