How can i do null check for embedded content types while fetching entries

i am using nextjs and fetching all contentful entries.
if my content type has some embedded content which is either invalid or unpublished my page results in error. any suggestions how to recursively check for null content in my content type?