Assign queue values to dynamic array

In reply to dave_59:

  task data_read(fifo_trans trans);
    fifo_trans mon_tran_r;
	mon_tran_r=fifo_trans::type_id::create("mon_tran_r");
	
 				 while ((vif.tb_mon_re.cb_mon_re.re===1'b1) && (vif.tb_mon_re.cb_mon_re.empty === 1'b0)) begin
				  @(vif.tb_mon_re.cb_mon_re);
					`uvm_info(get_name() ,"READ task of monitor", UVM_LOW)
					data_que.push_back(vif.tb_mon_re.cb_mon_re.dout);
					
					
					
					@(vif.tb_mon_re.cb_mon_re);
					
				 end 	
				  
					`uvm_info(get_name() ,"END OF READ task of monitor ", UVM_LOW)
					
					for ( int index=0 ; index < trans.data.size()  ; index++) // gives fatal for bad handle of refenrece
					mon_tran_r.data[index] = data_que[index];
					
					mon_tran_r.flag_empty = vif.tb_mon_re.cb_mon_re.empty ;
					
				    `uvm_info(get_name() ,$psprintf("monitor values READ : %s",mon_tran_r.sprint()), UVM_LOW)
		            ana_port.write(mon_tran_r);
					
 endtask

now in this example trans is the randomized transaction that i get from my transaction , and inside trans , there is data { which is dynamic array } which is
getting randomized . now i want to transfer all the elements of data_que to data {which is other transaction } but the size to be remained as that of randomized
data . i tried what you said but i am getting en fatal error
this task if of monitor4 only which is giving fatal

** Fatal: (SIGSEGV) Bad handle or reference.

Time: 59 ns Iteration: 2 Process: /uvm_pkg::uvm_task_phase::execute/fork#2781(#ublk#26#2781)_fe72e39 File: fifo_monitor4.sv

Fatal error in Function uvm_pkg/uvm_object::sprint at C:/Program Files/Questa/win32/…/verilog_src/uvm-1.0p1/src/base/uvm_object.svh line 901

HDL call sequence:

Stopped at C:/Program Files/Questa/win32/…/verilog_src/uvm-1.0p1/src/base/uvm_object.svh 901 Function uvm_pkg/uvm_object::sprint

called from fifo_monitor4.sv 100 Task top/fifo_monitor::data_read

called from fifo_monitor4.sv 48 Task top/fifo_monitor::run_phase

called from C:/Program Files/Questa/win32/…/verilog_src/uvm-1.0p1/src/base/uvm_phases.svh 583 Task uvm_pkg/uvm_run_phase::exec_task

called from C:/Program Files/Questa/win32/…/verilog_src/uvm-1.0p1/src/base/uvm_phases.svh 2788 Function uvm_pkg/uvm_task_phase::execute