diff --git a/c_glib/arrow-glib/reader.cpp b/c_glib/arrow-glib/reader.cpp index a21b3756167..ba835fd33a6 100644 --- a/c_glib/arrow-glib/reader.cpp +++ b/c_glib/arrow-glib/reader.cpp @@ -243,8 +243,8 @@ garrow_record_batch_stream_reader_new(GArrowInputStream *stream, auto arrow_input_stream = garrow_input_stream_get_raw(stream); std::shared_ptr arrow_reader; auto status = ReaderType::Open(arrow_input_stream, &arrow_reader); - auto subtype = std::dynamic_pointer_cast(arrow_reader); if (garrow_error_check(error, status, "[record-batch-stream-reader][open]")) { + auto subtype = std::dynamic_pointer_cast(arrow_reader); return garrow_record_batch_stream_reader_new_raw(&subtype); } else { return NULL; diff --git a/c_glib/arrow-glib/writer.cpp b/c_glib/arrow-glib/writer.cpp index c08db19987e..7d3b59457fd 100644 --- a/c_glib/arrow-glib/writer.cpp +++ b/c_glib/arrow-glib/writer.cpp @@ -223,8 +223,8 @@ garrow_record_batch_stream_writer_new(GArrowOutputStream *sink, auto status = WriterType::Open(arrow_sink, garrow_schema_get_raw(schema), &arrow_writer); - auto subtype = std::dynamic_pointer_cast(arrow_writer); if (garrow_error_check(error, status, "[record-batch-stream-writer][open]")) { + auto subtype = std::dynamic_pointer_cast(arrow_writer); return garrow_record_batch_stream_writer_new_raw(&subtype); } else { return NULL; @@ -270,8 +270,8 @@ garrow_record_batch_file_writer_new(GArrowOutputStream *sink, auto status = WriterType::Open(arrow_sink.get(), garrow_schema_get_raw(schema), &arrow_writer); - auto subtype = std::dynamic_pointer_cast(arrow_writer); if (garrow_error_check(error, status, "[record-batch-file-writer][open]")) { + auto subtype = std::dynamic_pointer_cast(arrow_writer); return garrow_record_batch_file_writer_new_raw(&subtype); } else { return NULL;