EntityMetadataWrapper

EntityMetadataWrapper: Be careful with empty / non-existing entities! (aka EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format.)

entity_metadata_wrapper() is an extremely helpful helper :)
Anyway today I found out something dangerous:

Be careful with constructs like this:

  1. $term = taxonomy_term_load($tid);
  2. $term_wrapper = entity_metadata_wrapper('taxonomy_term', $term);