From b20e3c794089703bd7bb49ef220fd1ede01213bc Mon Sep 17 00:00:00 2001 From: NoHomoBoi <36680385+KiritoDv@users.noreply.github.com> Date: Sun, 13 Sep 2020 16:44:24 -0500 Subject: [PATCH] Fixed BITDW level name --- src/text/text-loader.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/text/text-loader.c b/src/text/text-loader.c index 661960f9..a584d901 100644 --- a/src/text/text-loader.c +++ b/src/text/text-loader.c @@ -104,21 +104,24 @@ void load_language(char* jsonTxt, s8 language){ const cJSON *act = NULL; char* courseName = cJSON_GetObjectItemCaseSensitive(course, "course")->valuestring; - languages[language]->courses[courseID] = getTranslatedText(courseName); - courseID++; + if(courseID + 1 <= cJSON_GetArraySize(courses) - 1){ + languages[language]->courses[courseID] = getTranslatedText(courseName); + courseID++; + } + cJSON_ArrayForEach(act, acts) { languages[language]->acts[actID] = getTranslatedText(act->valuestring); actSize += strlen(act->valuestring); actID++; } actAmount += cJSON_GetArraySize(acts); - actSize += strlen(courseName); + actSize += strlen(courseName); } languages[language]->acts = realloc(languages[language]->acts, sizeof(u8*) * (actAmount * actSize)); - cJSON_ArrayForEach(secret, secrets) { - languages[language]->courses[courseID] = getTranslatedText(secret->valuestring); + cJSON_ArrayForEach(secret, secrets) { + languages[language]->courses[courseID] = getTranslatedText(secret->valuestring); courseID++; }