Skip to content

Commit e983ddb

Browse files
committed
Fixed the eof when reading the data producing N+1 frames
1 parent 5989454 commit e983ddb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Data.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,19 @@ ezc3d::DataNS::Data::Data(
3232
ezc3d::DataNS::RotationNS::Info rotationsInfo(c3d);
3333

3434
for (size_t j = 0; j < c3d.header().nbFrames(); ++j){
35-
if (file.eof())
36-
break;
37-
3835
ezc3d::DataNS::Frame f;
3936
// Read point 3d
4037
f.add(ezc3d::DataNS::Points3dNS::Points(c3d, file, pointsInfo));
4138

4239
// Read analogs
4340
f.add(ezc3d::DataNS::AnalogsNS::Analogs(c3d, file, analogsInfo));
41+
42+
// If we ran out of space, then leave. The reason we test here is because
43+
// is set after failing, resulting in one extra frame added if this if
44+
// is after the push_back
45+
if (file.eof())
46+
break;
47+
4448
_frames.push_back(f);
4549
}
4650

0 commit comments

Comments
 (0)