diff --git a/cpp/src/arrow/ipc/reader.cc b/cpp/src/arrow/ipc/reader.cc index 877ab69a80503..d35236cc23835 100644 --- a/cpp/src/arrow/ipc/reader.cc +++ b/cpp/src/arrow/ipc/reader.cc @@ -655,6 +655,8 @@ Status ReadDictionary(const Buffer& metadata, DictionaryMemo* dictionary_memo, // The dictionary is embedded in a record batch with a single column auto batch_meta = dictionary_batch->data(); + CHECK_FLATBUFFERS_NOT_NULL(batch_meta, "DictionaryBatch.data"); + Compression::type compression; RETURN_NOT_OK(GetCompression(batch_meta, &compression)); if (compression == Compression::UNCOMPRESSED && @@ -673,8 +675,6 @@ Status ReadDictionary(const Buffer& metadata, DictionaryMemo* dictionary_memo, auto value_field = ::arrow::field("dummy", value_type); - CHECK_FLATBUFFERS_NOT_NULL(batch_meta, "DictionaryBatch.data"); - std::shared_ptr batch; ARROW_ASSIGN_OR_RAISE( batch, LoadRecordBatch(batch_meta, ::arrow::schema({value_field}),