diff --git a/additional_modules/gmap/gmap_plugin_style_gmap.inc b/additional_modules/gmap/gmap_plugin_style_gmap.inc
index 4cace42..ccbf264 100644
--- a/additional_modules/gmap/gmap_plugin_style_gmap.inc
+++ b/additional_modules/gmap/gmap_plugin_style_gmap.inc
@@ -45,10 +45,10 @@ class gmap_plugin_style_gmap extends views_plugin_style {
 
     $options['tooltipenabled'] = array('default' => 0);
     $options['tooltipfield'] = array('default' => '');
-    
+
     $options['bubbletextenabled'] = array('default' => 0);
     $options['bubbletextfield'] = array('default' => '');
-    
+
     return $options;
   }
 
@@ -107,7 +107,7 @@ class gmap_plugin_style_gmap extends views_plugin_style {
       $tooltip_field_obj = $this->view->display_handler->get_handler('field', $this->options['tooltipfield']);
       $tooltip_field = $tooltip_field_obj->field_alias;
     }
-    
+
     $bubbletext_field_alias = '';
     if ($this->options['bubbletextenabled']) {
       $bubbletext_field_obj = $this->view->display_handler->get_handler('field', $this->options['bubbletextfield']);
@@ -119,7 +119,7 @@ class gmap_plugin_style_gmap extends views_plugin_style {
       $marker_field_obj = $this->view->display_handler->get_handler('field', $this->options['markerfield']);
       $marker_field = $marker_field_obj->field_alias;
     }
-    
+
     // Determine rmt field.
     if ($this->options['enablermt']) {
       $rmt_field_obj = $this->view->display_handler->get_handler('field', $this->options['rmtfield']);
@@ -138,10 +138,10 @@ class gmap_plugin_style_gmap extends views_plugin_style {
 
     // Group the rows according to the grouping field, if specified.
     $sets = $this->render_grouping($this->view->result, $this->options['grouping']);
-    
-    // Let's make sure the individual fields are rendered 
+
+    // Let's make sure the individual fields are rendered
     $this->render_fields($this->view->result);
-    
+
     // Render each group separately and concatenate.  Plugins may override this
     // method if they wish some other way of handling grouping.
     $output = '';
@@ -161,6 +161,15 @@ class gmap_plugin_style_gmap extends views_plugin_style {
         $highlight_nid = $nodehandler->get_value();
       }
 
+      /*** Workaround for the bug http://drupal.org/node/1497512 ***/
+      if (!isset($records[0])) {
+        $records = array_values($records);
+      }
+      if (is_array($records[0]) && isset($records[0]['rows'])) {
+        $records = $records[0]['rows'];
+      }
+      /*** End of workaround ***/
+
       foreach ($records as $row_index => $row) {
         $this->view->row_index = $row_index;
         $lat = (float)$row->{$lat_field};
@@ -210,7 +219,7 @@ class gmap_plugin_style_gmap extends views_plugin_style {
           if ($this->options['tooltipenabled'] && !empty($tooltip_field) && !empty($row->{$tooltip_field})) {
             $tooltip = $row->{$tooltip_field};
           }
-          
+
           $bubbletext = NULL;
           if ($this->options['bubbletextenabled'] && !empty($bubbletext_field_alias) && !empty($row->{$bubbletext_field_alias})) {
             $bubbletext = $this->rendered_fields[$row_index][$this->options['bubbletextfield']];
@@ -459,7 +468,7 @@ class gmap_plugin_style_gmap extends views_plugin_style {
       '#process' => array('ctools_dependent_process'),
       '#dependency' => array('edit-style-options-bubbletextenabled' => array(TRUE)),
     );
-    
+
   }
 
   /**
