Skip to content

Commit

Permalink
Text and binary mode: Fix array deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
martinjaeger committed Mar 5, 2024
1 parent 1a09e22 commit 018b447
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/thingset_bin.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ static int bin_deserialize_value(struct thingset_context *ts,
break;
}
index++;
} while (index < array->num_elements);
} while (index < array->max_elements);

if (!check_only) {
array->num_elements = index;
Expand Down
6 changes: 5 additions & 1 deletion src/thingset_txt.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,11 +672,15 @@ static int txt_deserialize_value(struct thingset_context *ts,
break;
}
index++;
} while (index < array->num_elements);
} while (index < array->max_elements);

if (!check_only) {
array->num_elements = index;
}

if (err == -THINGSET_ERR_DESERIALIZATION_FINISHED) {
err = 0;
};
}

return err;
Expand Down

0 comments on commit 018b447

Please sign in to comment.