mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Make charmap-converting a non-UTF8 string non-fatal
This commit is contained in:
@@ -229,6 +229,10 @@ size_t charmap_Convert(char const *input, uint8_t *output)
|
||||
} else if (*input) { /* No match found */
|
||||
size_t codepointLen = readUTF8Char(output, input);
|
||||
|
||||
if (codepointLen == 0) {
|
||||
error("Input string is not valid UTF-8!");
|
||||
break;
|
||||
}
|
||||
input += codepointLen; /* OK because UTF-8 has no NUL in multi-byte chars */
|
||||
output += codepointLen;
|
||||
outputLen += codepointLen;
|
||||
|
||||
Reference in New Issue
Block a user