Skip to content

Commit 90250be

Browse files
authored
Merge pull request #270 from gorcha/strl-write-index
Fix off by one error in v,o indexing for string refs
2 parents 2d34a9c + 396d7dc commit 90250be

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/readstat_writer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,8 +604,8 @@ readstat_error_t readstat_insert_string_ref(readstat_writer_t *writer, const rea
604604
return READSTAT_ERROR_STRING_REFS_NOT_SUPPORTED;
605605

606606
if (ref && ref->first_o == -1 && ref->first_v == -1) {
607-
ref->first_o = writer->current_row;
608-
ref->first_v = variable->index;
607+
ref->first_o = writer->current_row + 1;
608+
ref->first_v = variable->index + 1;
609609
}
610610

611611
return writer->callbacks.write_string_ref(&writer->row[variable->offset], variable, ref);

0 commit comments

Comments
 (0)