Skip to content

Commit ac75550

Browse files
authored
Merge pull request #81 from hiimjasmine00/main
Fix out of range crash when exporting levels
2 parents 3703005 + 0bc6a78 commit ac75550

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/_MainLevelsEditorMenu.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,8 @@ class MainLevelsEditorMenu : public geode::Popup<> {
405405
auto level_export = level::exportLevelFile(level, path);
406406
if (level_export.isOk()) {
407407
auto dbg_json = level_export.unwrapOrDefault();
408-
dbg_json["levelString"] = dbg_json["levelString"].asString().unwrapOrDefault().erase(36, 9999999) + "...";
408+
auto level_string = dbg_json["levelString"].asString().unwrapOrDefault();
409+
if (level_string.size() > 35) dbg_json["levelString"] = level_string.erase(36, 9999999) + "...";
409410

410411
auto body = std::stringstream();
411412

0 commit comments

Comments
 (0)