Update rtext.c

This commit is contained in:
Ray
2025-09-04 23:53:26 +02:00
parent 0203a47bf9
commit 51aa8776bb

View File

@@ -1461,12 +1461,12 @@ char **LoadTextLines(const char *text, int *count)
}
char **lines = (char **)RL_CALLOC(lineCount, sizeof(char *));
for (int i = 0, l = 0, lineLen = 0; i < lineCount; i++, lineLen++)
for (int i = 0, l = 0, lineLen = 0; i <= textSize; i++, lineLen++)
{
if (text[i] == '\n')
if ((text[i] == '\n') || (text[i] == '\0'))
{
lines[l] = (char *)RL_CALLOC(lineLen + 1, 1);
strncpy(lines[l], &text[i - lineLen], lineLen);
strncpy(lines[l], &text[i - lineLen + 1], lineLen - 1);
lineLen = 0;
l++;
}