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 bff50338ba5f..b6c83f770b60 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;