diff --git a/theme/theme.inc b/theme/theme.inc
index e7f7a15..94199d9 100644
--- a/theme/theme.inc
+++ b/theme/theme.inc
@@ -727,7 +727,7 @@ function template_preprocess_views_view_grid(&$vars) {
         $remainders--;
       }
     }
-    for ($i = 0; $i < count($rows[0]); $i++) {
+    for ($i = 0; $i < (!empty($handler->options['fill_single_line']) ? $columns : count($rows[0])); $i++) {
       // This should be string so that's okay :)
       if (!isset($rows[count($rows) - 1][$i])) {
         $rows[count($rows) - 1][$i] = '';
