protect against a case when string field data value is null

This commit is contained in:
kimchy 2011-01-17 12:39:11 +02:00
parent 89d31bbfde
commit f2bd2c7bbd
1 changed files with 3 additions and 1 deletions

View File

@ -43,7 +43,9 @@ public abstract class StringFieldData extends FieldData<StringDocFieldData> {
@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;
}