Skip to content

Commit 5f3f6ac

Browse files
committed
addressed unchecked access to optional value
1 parent 828cee8 commit 5f3f6ac

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/Iteration.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ Iteration::Iteration() : Attributable(NoInit())
6161

6262
uint64_t Iteration::getCachedIterationIndex() const
6363
{
64-
return *get().m_iterationIndex;
64+
auto idx = get().m_iterationIndex;
65+
if (!idx.has_value())
66+
{
67+
throw error::Internal("Iteration index not known.");
68+
}
69+
return *idx;
6570
}
6671

6772
template <typename T>

0 commit comments

Comments
 (0)