Skip to content

Commit e80878c

Browse files
committed
Simple fix for error when reading in linear mode from file-based S
1 parent 7491a9b commit e80878c

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/Series.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,9 +1288,16 @@ void Series::flushFileBased(
12881288
bool flushIOHandler)
12891289
{
12901290
auto &series = get();
1291-
if (end == begin)
1291+
/*
1292+
* Iterations might have been present, but have been closed and deleted from
1293+
* internal structures. In this case, previous flushes were successful and
1294+
* the Series is now in written() state.
1295+
*/
1296+
if (end == begin && !written())
1297+
{
12921298
throw std::runtime_error(
12931299
"fileBased output can not be written with no iterations.");
1300+
}
12941301

12951302
switch (IOHandler()->m_frontendAccess)
12961303
{

src/snapshots/StatefulIterator.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,8 @@ std::optional<StatefulIterator *> StatefulIterator::loopBody(Seek const &seek)
648648
else if (
649649
series.IOHandler()->m_frontendAccess == Access::READ_LINEAR)
650650
{
651+
std::cout << "Closing Iteration " << *maybe_current_iteration
652+
<< std::endl;
651653
data.series.iterations.container().erase(
652654
*maybe_current_iteration);
653655
}

0 commit comments

Comments
 (0)