Undefined index: und on .tpl.php for content type How can i fix the error message?


  the error message is Notice: Undefined index: und in include() (line
  9 of /var/www/html/sites/all/modules/custom/theme/icons.tpl.php).


my code is:

&lt;?php 
global $language ;  
global $base_url , $base_path ;
$lang = $language-&gt;language;
$count = 0;
foreach ($data as $kay =&gt; $node_obj) {
    $node = node_load($node_obj-&gt;nid);
if (isset($node-&gt;field_description[$lang])) {
    $img_url = $node-&gt;field_icon['und'][0]['uri'] ;
$count++;


?>
I fix it by 

add 

!empty( )


like this

$img_url = !empty($node-&gt;field_icon['und'][0]['uri']) ;