Skip to content

Commit

Permalink
DBFReader: row.getString() does not return null for NULL MEMO field
Browse files Browse the repository at this point in the history
Fix #121
  • Loading branch information
albfernandez committed Feb 29, 2024
1 parent 9661e20 commit a53db3a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/main/java/com/linuxense/javadbf/DBFMemoFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ protected byte[] readBinary(int block) {
}

protected Object readData(int block, DBFDataType type) {
if (block <= 0) {
return null;
}
long blockStart = this.blockSize * (long) block;
DBFDataType usedType = null;
try {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/linuxense/javadbf/DBFReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ private Object readMemoField(DBFField field) throws IOException {
else {
nBlock = DBFUtils.readLittleEndianInt(this.dataInputStream);
}
if (this.memoFile != null && nBlock != null) {
if (this.memoFile != null && nBlock != null && nBlock.intValue() > 0) {
DBFDataType type = field.getType();
if (type == DBFDataType.MEMO && fieldsAsBinary.contains(field.getName().toUpperCase())) {
type = DBFDataType.BINARY;
Expand Down

0 comments on commit a53db3a

Please sign in to comment.