For future ref, the source for this technique can be found on drupal.org:
Atomox commented 2 years ago Trying to load a field on an entity, but an unset field throws an exception, and breaks your page?
There doesn't seem to be a consistent way to check if the field is set. However, try these approaches:
For simple fields, entityMetadataWrappers have extended the isset() to work with simple fields.
Either use isset() as normal, or: