diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/search/strategy/GridSearchStrategy.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/search/strategy/GridSearchStrategy.java
index a7eb32f..dc356ab 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/search/strategy/GridSearchStrategy.java
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/search/strategy/GridSearchStrategy.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2012 Original authors and others.
+ * Copyright (c) 2012, 2015 Original authors and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
  *
  * Contributors:
  *     Original authors and others - initial API and implementation
+ *     Dirk Fauth <dirk.fauth@googlemail.com> - Bug 458537
  ******************************************************************************/
 package org.eclipse.nebula.widgets.nattable.search.strategy;
 
@@ -28,8 +29,7 @@ public class GridSearchStrategy extends AbstractSearchStrategy {
 
     public GridSearchStrategy(IConfigRegistry configRegistry,
             boolean wrapSearch, boolean columnFirst) {
-        this(configRegistry, wrapSearch, ISearchDirection.SEARCH_FORWARD,
-                columnFirst);
+        this(configRegistry, wrapSearch, ISearchDirection.SEARCH_FORWARD, columnFirst);
     }
 
     public GridSearchStrategy(IConfigRegistry configRegistry,
@@ -46,18 +46,15 @@ public static class GridRectangle {
     }
 
     @Override
-    public PositionCoordinate executeSearch(Object valueToMatch)
-            throws PatternSyntaxException {
+    public PositionCoordinate executeSearch(Object valueToMatch) throws PatternSyntaxException {
 
         ILayer contextLayer = getContextLayer();
         if (!(contextLayer instanceof SelectionLayer)) {
             throw new RuntimeException("For the GridSearchStrategy to work it needs the selectionLayer to be passed as the contextLayer."); //$NON-NLS-1$
         }
         SelectionLayer selectionLayer = (SelectionLayer) contextLayer;
-        PositionCoordinate selectionAnchor = selectionLayer
-                .getSelectionAnchor();
-        boolean hadSelectionAnchor = selectionAnchor.columnPosition >= 0
-                && selectionAnchor.rowPosition >= 0;
+        PositionCoordinate selectionAnchor = selectionLayer.getSelectionAnchor();
+        boolean hadSelectionAnchor = selectionAnchor.columnPosition >= 0 && selectionAnchor.rowPosition >= 0;
         if (!hadSelectionAnchor) {
             selectionAnchor.columnPosition = 0;
             selectionAnchor.rowPosition = 0;
@@ -82,8 +79,7 @@ public PositionCoordinate executeSearch(Object valueToMatch)
         }
 
         // Pick start and end values depending on the direction of the search.
-        int direction = this.searchDirection.equals(ISearchDirection.SEARCH_FORWARD) ? 1
-                : -1;
+        int direction = this.searchDirection.equals(ISearchDirection.SEARCH_FORWARD) ? 1 : -1;
         int firstDimStart;
         int firstDimEnd;
         int secondDimStart;
@@ -102,8 +98,7 @@ public PositionCoordinate executeSearch(Object valueToMatch)
 
         // Move to the next cell if a selection was active and it's not
         // an incremental search.
-        final boolean startWithNextCell = hadSelectionAnchor
-                && !isIncremental();
+        final boolean startWithNextCell = hadSelectionAnchor && !isIncremental();
         if (startWithNextCell) {
             if (secondDimPosition + direction != secondDimEnd) {
                 // Increment the second dimension
@@ -125,8 +120,9 @@ public PositionCoordinate executeSearch(Object valueToMatch)
         }
 
         // Get a sequence of ranges for searching.
-        List<GridRectangle> gridRanges = getRanges(firstDimPosition,
-                secondDimPosition, direction, firstDimStart, firstDimEnd,
+        List<GridRectangle> gridRanges = getRanges(
+                firstDimPosition, secondDimPosition, direction,
+                firstDimStart, firstDimEnd,
                 secondDimStart, secondDimEnd);
 
         // Perform the search.
@@ -134,8 +130,7 @@ public PositionCoordinate executeSearch(Object valueToMatch)
         Comparator<String> comparator2 = (Comparator<String>) getComparator();
         return CellDisplayValueSearchUtil.findCell(getContextLayer(),
                 this.configRegistry, gridRanges, valueToMatch, comparator2,
-                isCaseSensitive(), isWholeWord(), isRegex(), isColumnFirst(),
-                isIncludeCollapsed());
+                isCaseSensitive(), isWholeWord(), isRegex(), isColumnFirst(), isIncludeCollapsed());
     }
 
     /**
@@ -151,9 +146,9 @@ public PositionCoordinate executeSearch(Object valueToMatch)
      * @param secondDimEnd
      * @return
      */
-    private List<GridRectangle> getRanges(int firstDimPosition,
-            int secondDimPosition, int direction, int firstDimStart,
-            int firstDimEnd, int secondDimStart, int secondDimEnd) {
+    private List<GridRectangle> getRanges(
+            int firstDimPosition, int secondDimPosition, int direction,
+            int firstDimStart, int firstDimEnd, int secondDimStart, int secondDimEnd) {
 
         List<GridRectangle> gridRanges = new ArrayList<GridRectangle>();
         GridRectangle gridRange;
@@ -161,22 +156,25 @@ private List<GridRectangle> getRanges(int firstDimPosition,
         // One first-dimension slice starting at the second
         // dimension selection.
         gridRange = new GridRectangle();
-        gridRange.firstDim = new Range(firstDimPosition, firstDimPosition
-                + direction);
+        gridRange.firstDim = new Range(firstDimPosition, firstDimPosition + direction);
         gridRange.secondDim = new Range(secondDimPosition, secondDimEnd);
         gridRanges.add(gridRange);
 
+        if (firstDimStart == 0 && firstDimEnd == 0) {
+            // Bug 458537 - this might happen for a grid without content rows
+            return gridRanges;
+        }
+
         // One or more first-dimension slices to the wrapping boundary.
         gridRange = new GridRectangle();
-        gridRange.firstDim = new Range(firstDimPosition + direction,
-                firstDimEnd);
+        gridRange.firstDim = new Range(firstDimPosition + direction, firstDimEnd);
         gridRange.secondDim = new Range(secondDimStart, secondDimEnd);
         gridRanges.add(gridRange);
 
         // We're done if wrapping is not enabled or if we've already covered the
         // whole table.
-        if (!this.wrapSearch || firstDimPosition == firstDimStart
-                && secondDimPosition == secondDimStart) {
+        if (!this.wrapSearch
+                || firstDimPosition == firstDimStart && secondDimPosition == secondDimStart) {
             return gridRanges;
         }
 
@@ -189,8 +187,7 @@ private List<GridRectangle> getRanges(int firstDimPosition,
 
         // One first-dimension slice ending at the second-dimension selection.
         gridRange = new GridRectangle();
-        gridRange.firstDim = new Range(firstDimPosition, firstDimPosition
-                + direction);
+        gridRange.firstDim = new Range(firstDimPosition, firstDimPosition + direction);
         gridRange.secondDim = new Range(secondDimStart, secondDimPosition);
         gridRanges.add(gridRange);
 
