mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-31 00:18:39 -06:00
fix random crash
This commit is contained in:
@@ -81,26 +81,30 @@ namespace openspace {
|
||||
|
||||
bool RadecManager::radecParser(int index) const{
|
||||
std::string filename;
|
||||
filename = _dataFiles[index];
|
||||
std::ifstream ifs(filename);
|
||||
nlohmann::json j = nlohmann::json::parse(ifs);
|
||||
if (index > -1 && index < _dataFiles.size()) {
|
||||
filename = _dataFiles[index];
|
||||
std::ifstream ifs(filename);
|
||||
nlohmann::json j = nlohmann::json::parse(ifs);
|
||||
|
||||
int objectCounter = 0;
|
||||
for (const auto& pos : j["Positions"]) {
|
||||
objectCounter++;
|
||||
try {
|
||||
position.timeStamp = pos["TimeStamp"].get<std::string>();
|
||||
position.ra = pos["RADn"].get<double>();
|
||||
position.dec = pos["DecDn"].get<double>();
|
||||
position.range = pos["GeoRngDn"].get<double>();
|
||||
position.lightTravelTime = pos["DLT"].get<double>();
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
LERROR(fmt::format("{}: Error in json object number {} while reading file '{}'", objectIdentifier, objectCounter, filename));
|
||||
}
|
||||
RadecManager::positions.push_back(position);
|
||||
int objectCounter = 0;
|
||||
for (const auto& pos : j["Positions"]) {
|
||||
objectCounter++;
|
||||
try {
|
||||
position.timeStamp = pos["TimeStamp"].get<std::string>();
|
||||
position.ra = pos["RADn"].get<double>();
|
||||
position.dec = pos["DecDn"].get<double>();
|
||||
position.range = pos["GeoRngDn"].get<double>();
|
||||
position.lightTravelTime = pos["DLT"].get<double>();
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
LERROR(fmt::format("{}: Error in json object number {} while reading file '{}'", objectIdentifier, objectCounter, filename));
|
||||
}
|
||||
RadecManager::positions.push_back(position);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
else return false;
|
||||
|
||||
}
|
||||
|
||||
void RadecManager::updateActiveMinute(int idx) const{
|
||||
|
||||
Reference in New Issue
Block a user