How do you add a conditional to check if the Node object exists? 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-&gt;field_device_type_vocabulary[0]-&gt;tid-&gt;value();
return $tid;
If you are on a non-node page, menu_get_object() returns NULL.