Fixed a bug which made reading an UTF-8 character impossible.

This commit is contained in:
Eric-Paul Ickhorn 2023-12-12 23:26:31 +01:00
parent d3e590e4ef
commit cd6d0773b3
Signed by: epickh
GPG Key ID: F5EBBE013924D95F
1 changed files with 2 additions and 2 deletions

View File

@ -1,9 +1,9 @@
#include <librr/runes.h>
isz_t rr_distance_to_last_utf8_rune_start(const char *string, usz_t offset)
isz_t rr_distance_to_last_utf8_rune_start(const char *string, isz_t offset)
{
usz_t bytes_walked = 0;
while(bytes_walked < offset)
while((offset - bytes_walked) >= 0)
{
if(bytes_walked > 4)
return -1;