From 3ba500ed9f2f073bd3c35e9b09d25bf0d08a09e8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 11 Dec 2024 12:58:27 -0500 Subject: Invert condition to make lack of underflow more obvious --- src/writer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/writer.c') 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; } } -- cgit v1.2.1