Browse Source

repair core dump when tensor_table is empty

tags/v0.5.0-beta
ms_yan 5 years ago
parent
commit
e6ea2e8925
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      mindspore/ccsrc/dataset/engine/data_buffer.cc

+ 1
- 1
mindspore/ccsrc/dataset/engine/data_buffer.cc View File

@@ -98,7 +98,7 @@ Status DataBuffer::GetTensor(std::shared_ptr<Tensor> *ptr, int32_t row_id, int32

// Remove me!! Callers should fetch rows via pop
Status DataBuffer::GetRow(int32_t row_id, TensorRow *ptr) const {
if (row_id < tensor_table_->size()) {
if (tensor_table_ && !tensor_table_->empty() && row_id < tensor_table_->size()) {
*ptr = tensor_table_->at(row_id);
} else {
std::string err_msg = "rowId for mTensorTable out of range: " + std::to_string(row_id);


Loading…
Cancel
Save