Fixes a NPE in swift when maxResults is set to 0

This commit is contained in:
Zack Shoylev 2015-02-09 18:24:02 -06:00
parent 0423ba802a
commit ba4435040f
1 changed files with 4 additions and 1 deletions

View File

@ -78,7 +78,10 @@ public class ParseObjectInfoListFromJsonResponse extends ParseJson<PageSet<Objec
}
}));
boolean truncated = options.getMaxResults() == returnVal.size();
String marker = truncated ? returnVal.last().getName() : null;
String marker = null;
if (truncated && !returnVal.isEmpty()) {
marker = returnVal.last().getName();
}
return new PageSetImpl<ObjectInfo>(returnVal, marker);
} catch (IOException e) {
throw new RuntimeException("problem reading response from request: " + request, e);