Skip to content

Commit 3b78b50

Browse files
committed
Added warning about inconsistent number of values in particle vector. Still not sure of the cause, but it should prevent the crash.
1 parent 5b61a55 commit 3b78b50

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Studio/Analysis/AnalysisTool.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,6 +2136,12 @@ Particles AnalysisTool::convert_from_combined(const Eigen::VectorXd& points) {
21362136
int idx = 0;
21372137
for (int d = 0; d < worlds.size(); d++) {
21382138
Eigen::VectorXd new_world(worlds[d].size());
2139+
2140+
if (idx + new_world.size() > points.size()) {
2141+
SW_WARN("Inconsistent number of values in particle vector");
2142+
return {};
2143+
}
2144+
21392145
for (int i = 0; i < worlds[d].size(); i++) {
21402146
new_world[i] = points[idx++];
21412147
}

0 commit comments

Comments
 (0)