aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-12-11 12:58:27 -0500
committerDavid Robillard <d@drobilla.net>2024-12-11 13:06:13 -0500
commit3ba500ed9f2f073bd3c35e9b09d25bf0d08a09e8 (patch)
tree5a2d982420453df2e0e8d4d865286ddf8036c8b9 /src
parent7dfe951f220cefdd6d40b575d26fb38fd43a0a2f (diff)
downloadserd-3ba500ed9f2f073bd3c35e9b09d25bf0d08a09e8.tar.gz
serd-3ba500ed9f2f073bd3c35e9b09d25bf0d08a09e8.tar.bz2
serd-3ba500ed9f2f073bd3c35e9b09d25bf0d08a09e8.zip
Invert condition to make lack of underflow more obvious
Diffstat (limited to 'src')
-rw-r--r--src/writer.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/writer.c b/src/writer.c
index 4623c388..f0a9ad16 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -494,13 +494,13 @@ write_text(SerdWriter* const writer,
return st;
}
- if (!size) {
+ if (size > 0U) {
+ i += size - 1U;
+ } else {
// Corrupt input, write replacement character and scan to the next start
st = esink(replacement_char, sizeof(replacement_char), writer);
for (; i < n_bytes && (utf8[i] & 0x80U); ++i) {
}
- } else {
- i += size - 1U;
}
}