Field collection with condition node tpl I've been researching this for the last few days and I cant find a clear explanation of this issue im facing.  I'm receiving an error when a node has an empty collection with no values.

The collection field: field_window_shade
The fields within the collection: field_question, field_answer

Here is my code that is only looping thru the collection array within my node.tpl:

            $wrapper  = entity_metadata_wrapper('node', $node);
            $formtype = field_get_items('node', $node, 'field_window_shade');

            foreach($formtype as $itemid) { 
                 $item = field_collection_field_get_entity($itemid);
                 print $item-&gt;field_question['und'][0]['value'];
                 print $item-&gt;field_answer['und'][0]['value'];
            }


I am after something like this:

            $wrapper  = entity_metadata_wrapper('node', $node);
            $formtype = field_get_items('node', $node, 'field_window_shade');

            if (isset($wrapper-&gt;field_question)) {
              foreach($formtype as $itemid) { 
                 $item = field_collection_field_get_entity($itemid);
                 print $item-&gt;field_question['und'][0]['value'];
                 print $item-&gt;field_answer['und'][0]['value'];
              }
            }


I've seen this question asked about 5 different times with 10 different solutions and I can't seem to reach a solution here.

Thank you !
Did you try field_collection_item in entity_metadata_wrapper? I mean this

$wrapper  = entity_metadata_wrapper('node', $node);
$raw_collection = $wrapper-&gt;field_window_shade-&gt;value();
$fwrapper = entity_metadata_wrapper('field_collection_item', $raw_collection);


Now use $fwrapper to extract the items (This code is not completely accurate a few modification may be needed) 

Visit Extracting a specific data part of a Field Collection Item for more details. Also Programmatically create and update field collection with Entity API and Understanding Field Collection Values can be helpful.