Skip to content

Commit

Permalink
protect against a case when string field data value is null
Browse files Browse the repository at this point in the history
  • Loading branch information
kimchy committed Jan 17, 2011
1 parent dfddde3 commit 73783e1
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -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;
}
Expand Down

0 comments on commit 73783e1

Please sign in to comment.