diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java index 1ef1633d193e..138432aada32 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java @@ -913,16 +913,19 @@ public CellScanner cellScanner() { @Override public Cell current() { - if (cells == null + if (isEmpty() || cellScannerIndex == INITIAL_CELLSCANNER_INDEX - || cellScannerIndex >= cells.length) + || cellScannerIndex >= cells.length) { return null; + } return this.cells[cellScannerIndex]; } @Override public boolean advance() { - if (cells == null) return false; + if (isEmpty()) { + return false; + } cellScannerIndex++; if (cellScannerIndex < this.cells.length) { return true;