diff --git a/includes/views_customfield_handler_field_phpcode.inc b/includes/views_customfield_handler_field_phpcode.inc
index c484384..5a36982 100644
--- a/includes/views_customfield_handler_field_phpcode.inc
+++ b/includes/views_customfield_handler_field_phpcode.inc
@@ -17,11 +17,11 @@ define('VIEWS_CUSTOMFIELD_SORTABLE_NAT_NOCASE', 5);
 
 class views_customfield_handler_field_phpcode extends views_handler_field {
   var $static;
-  
+
   function query() {
     $this->field_alias = 'customfield_phpcode_'. $this->position;
   }
-  
+
   function option_definition() {
     $options = parent::option_definition();
     $options['value'] = array('default' => '');
@@ -39,7 +39,7 @@ class views_customfield_handler_field_phpcode extends views_handler_field {
       '#title' => t('Value'),
       '#default_value' => $this->options['value'],
       '#rows' => 5,
-      '#description' => 
+      '#description' =>
         t('The text that should be displayed.')
         .' '.t('Include &lt;?php ?&gt; delimiters when using PHP code.')
         .' '.t('Available variables:').'<br/>'
@@ -85,7 +85,7 @@ class views_customfield_handler_field_phpcode extends views_handler_field {
     foreach ($this->view->result as $i => $row) {
       $this->view->result[$i]->{$this->field_alias} = $this->render_row($row);
     }
-    
+
     // If we're sorting, do the actual sorting then fix the results as per the pager info.
     if ($this->options['sortable'] != VIEWS_CUSTOMFIELD_SORTABLE_NO && $this->sort_order) {
       usort($this->view->result, array(new views_customfield_sorter($this->options['sortable'], $this->sort_order, $this->field_alias), 'sort'));
@@ -123,7 +123,7 @@ class views_customfield_handler_field_phpcode extends views_handler_field {
         $results = array_slice($this->view->result, $offset, $this->pager['items_per_page']);
         $this->view->result = $results;
       }
-      
+
       $this->view->pager = $this->pager;
     }
   }
@@ -146,7 +146,10 @@ class views_customfield_handler_field_phpcode extends views_handler_field {
       if (is_a($h, 'content_handler_field_multiple') && $h->defer_query) {
         // content_handler_field_multiple stores its query results in $obj->field_values
         $tmp = array();
-        if(!empty($h->field_values[$values->{$h->field_alias}])) {
+        if (   !empty($h->field_alias)
+            && !empty($values->{$h->field_alias})
+            && !empty($h->field_values[$values->{$h->field_alias}])
+              ) {
           foreach ($h->field_values[$values->{$h->field_alias}] as $k => $v) {
             $tmp[$k] = $v;
             // clean up a bit
@@ -157,13 +160,13 @@ class views_customfield_handler_field_phpcode extends views_handler_field {
         $values->{$h->table.'_'.$h->field} = $tmp;
       }
     }
-    
+
     return $this->render_phpcode($this->options['value'], $this->static, $values);
   }
 
   /**
    * Prepare and evaluate of a string of PHP code.
-   * 
+   *
    * This method and eval_phpcode are mostly a copy of drupal_eval().
    *
    * @param string $code
@@ -173,10 +176,10 @@ class views_customfield_handler_field_phpcode extends views_handler_field {
    */
   function render_phpcode($code, &$static, $data) {
     global $theme_path, $theme_info, $conf;
-  
+
     // Store current theme path.
     $old_theme_path = $theme_path;
-  
+
     // Restore theme_path to the theme, as long as drupal_eval() executes,
     // so code evaluted will not see the caller module as the current theme.
     // If theme info is not initialized get the path from theme_default.
@@ -186,12 +189,12 @@ class views_customfield_handler_field_phpcode extends views_handler_field {
     else {
       $theme_path = dirname($theme_info->filename);
     }
-  
+
     $output = $this->eval_phpcode($code, $static, $data);
-  
+
     // Recover original theme path.
     $theme_path = $old_theme_path;
-  
+
     return $output;
   }
 
