]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - utf8lib.c
Fix again u8_COM_StringLengthNoColors returning always 0 if end is NULL (strlennocol...
[xonotic/darkplaces.git] / utf8lib.c
index 0461672d796688b3bee06f2ab17a2bc058a9067d..268ec7e3e84b75a24c2f61790cb83f8cf0995327 100644 (file)
--- a/utf8lib.c
+++ b/utf8lib.c
@@ -691,7 +691,7 @@ u8_COM_StringLengthNoColors(const char *_s, size_t size_s, qboolean *valid)
 
        for(;;)
        {
-               switch((s >= end) ? 0 : *s)
+               switch((s == end) ? 0 : *s)
                {
                        case 0:
                                if(valid)
@@ -756,7 +756,7 @@ u8_COM_StringLengthNoColors(const char *_s, size_t size_s, qboolean *valid)
                        return len;
                }
 
-               if(s + st + ln >= end)
+               if(end && s + st + ln > end)
                {
                        // string length exceeded by new character
                        if(valid)