Permalink
Browse files

protect against a case when string field data value is null

  • Loading branch information...
1 parent dfddde3 commit 73783e16693119288e12750a0aaa43fec17fcf2a @kimchy kimchy committed Jan 17, 2011
@@ -43,7 +43,9 @@ protected StringFieldData(String fieldName, String[] values) {
@Override protected long computeSizeInBytes() {
long size = RamUsage.NUM_BYTES_ARRAY_HEADER;
for (String value : values) {
- size += RamUsage.NUM_BYTES_OBJECT_HEADER + value.length() * RamUsage.NUM_BYTES_CHAR + (3 * RamUsage.NUM_BYTES_INT);
+ if (value != null) {
+ size += RamUsage.NUM_BYTES_OBJECT_HEADER + value.length() * RamUsage.NUM_BYTES_CHAR + (3 * RamUsage.NUM_BYTES_INT);
+ }
}
return size;
}

0 comments on commit 73783e1

Please sign in to comment.