Skip to content

Commit

Permalink
Check for NULL record batch in hasNextRecordBatch.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevingurney committed Dec 4, 2024
1 parent 55dee07 commit a2d5673
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void RecordBatchStreamReader::readRecordBatch(
if (!nextRecordBatch) {
MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(nextRecordBatch, reader->Next(), context, error::IPC_RECORD_BATCH_READ_FAILED);
}
auto record_batch_proxy = std::make_shared<RecordBatchProxy>(std::move(nextRecordBatch));
auto record_batch_proxy = std::make_shared<RecordBatchProxy>(nextRecordBatch);
const auto record_batch_proxy_id = libmexclass::proxy::ProxyManager::manageProxy(record_batch_proxy);
// Once we have "consumed" the next RecordBatch, set nextRecordBatch to nullptr
// so that the next call to hasNextRecordBatch correctly checks whether there are more record batches remaining in the IPC Stream.
Expand All @@ -108,6 +108,9 @@ void RecordBatchStreamReader::hasNextRecordBatch(
// so that we can return it on the next
// call to readRecordBatch.
nextRecordBatch = *maybe_record_batch;
if (!nextRecordBatch) {
has_next_record_batch = false;
}
}
}

Expand Down

0 comments on commit a2d5673

Please sign in to comment.