Skip to content

Commit 98fb501

Browse files
committed
Only verify storeChunk on constant components if its not empty
1 parent cd6ee79 commit 98fb501

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/RecordComponent.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -651,12 +651,15 @@ void RecordComponent::storeChunk(
651651
void RecordComponent::verifyChunk(
652652
Datatype dtype, Offset const &o, Extent const &e) const
653653
{
654-
if (constant())
655-
throw std::runtime_error(
656-
"Chunks cannot be written for a constant RecordComponent.");
657-
if (empty())
658-
throw std::runtime_error(
659-
"Chunks cannot be written for an empty RecordComponent.");
654+
if (!std::all_of(e.begin(), e.end(), [](auto val) { return val != 0; }))
655+
{
656+
if (constant())
657+
throw std::runtime_error(
658+
"Chunks cannot be written for a constant RecordComponent.");
659+
if (empty())
660+
throw std::runtime_error(
661+
"Chunks cannot be written for an empty RecordComponent.");
662+
}
660663
if (!isSame(dtype, getDatatype()))
661664
{
662665
std::ostringstream oss;

0 commit comments

Comments
 (0)