Skip to content

Commit

Permalink
Merge pull request #89573 from timothyqiu/hop
Browse files Browse the repository at this point in the history
Fix crash when columns are skipped in CSV translation
  • Loading branch information
akien-mga committed Apr 8, 2024
2 parents 7d96ec4 + f98d552 commit bfccd57
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion editor/import/resource_importer_csv_translation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,12 @@ Error ResourceImporterCSVTranslation::import(const String &p_source_file, const
if (!key.is_empty()) {
ERR_CONTINUE_MSG(line.size() != locales.size() + (int)skipped_locales.size() + 1, vformat("Error importing CSV translation: expected %d locale(s), but the '%s' key has %d locale(s).", locales.size(), key, line.size() - 1));

int write_index = 0; // Keep track of translations written in case some locales are skipped.
for (int i = 1; i < line.size(); i++) {
if (skipped_locales.has(i)) {
continue;
}
translations.write[i - 1]->add_message(key, line[i].c_unescape());
translations.write[write_index++]->add_message(key, line[i].c_unescape());
}
}
} while (!f->eof_reached());
Expand Down

0 comments on commit bfccd57

Please sign in to comment.