Skip to content

Commit

Permalink
Use replace to avoid JSON crash
Browse files Browse the repository at this point in the history
  • Loading branch information
levinli303 committed Nov 6, 2020
1 parent 1312152 commit 1e712fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/src/main/cpp/CelestiaEclipseFinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ Java_space_celestia_mobilecelestia_core_CelestiaEclipseFinder_c_1search(JNIEnv *
eclipse["endTime"] = result.endTime;
j.push_back(eclipse);
}
return env->NewStringUTF(j.dump().c_str());
return env->NewStringUTF(j.dump(-1, ' ', false, nlohmann::detail::error_handler_t::replace).c_str());
}
4 changes: 2 additions & 2 deletions app/src/main/cpp/CelestiaUniverse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ Java_space_celestia_mobilecelestia_core_CelestiaUniverse_c_1getChildrenForStar(J
create_browser_item_and_add(j, _("Spacecraft"), BROWSER_ITEM_TYPE_BODY, spacecrafts);
}

return env->NewStringUTF(j.dump().c_str());
return env->NewStringUTF(j.dump(-1, ' ', false, nlohmann::detail::error_handler_t::replace).c_str());
}

extern "C"
Expand Down Expand Up @@ -265,7 +265,7 @@ Java_space_celestia_mobilecelestia_core_CelestiaUniverse_c_1getChildrenForBody(J
create_browser_item_and_add(j, _("Locations"), BROWSER_ITEM_TYPE_LOCATION, locationsMap);
}

return env->NewStringUTF(j.dump().c_str());
return env->NewStringUTF(j.dump(-1, ' ', false, nlohmann::detail::error_handler_t::replace).c_str());
}

extern "C"
Expand Down

0 comments on commit 1e712fb

Please sign in to comment.