diff --git a/java/client/src/main/java/com/youtube/vitess/client/cursor/CursorWithError.java b/java/client/src/main/java/com/youtube/vitess/client/cursor/CursorWithError.java
index <HASH>..<HASH> 100644
--- a/java/client/src/main/java/com/youtube/vitess/client/cursor/CursorWithError.java
+++ b/java/client/src/main/java/com/youtube/vitess/client/cursor/CursorWithError.java
@@ -12,8 +12,8 @@ public class CursorWithError {
     private final Vtrpc.RPCError error;
 
     public CursorWithError(Query.ResultWithError resultWithError) {
-        if (null == resultWithError.getError() || Vtrpc.ErrorCode.SUCCESS == resultWithError
-            .getError().getCode()) {
+      if (!resultWithError.hasError() ||
+          Vtrpc.ErrorCode.SUCCESS == resultWithError.getError().getCode()) {
             this.cursor = new SimpleCursor(resultWithError.getResult());
             this.error = null;
         } else {
Fixing a java error.

Was picked up by our internal java compiler: a proto returned value
cannot be null.