I have the following code, but how do I add a conditional to check if the menu_get_object() is grabbing a node object or not? Im mainly using this in my contextual filter in views and its throwing an error on etity_metadata_wrapper() as its trying to load a node page while its in the view page. I'm not sure what condition to check before it returns anything. thanks!
$node = menu_get_object();
$wrapper = entity_metadata_wrapper('node', $node);
$tid = $wrapper->field_device_type_vocabulary[0]->tid->value();
return $tid;