The object at dereference depth 3 is being used before it was constructed/allocated.Please make sure that the object is allocated before using it

Error-[NOA] Null object access
/work/home/lliu/project/ipdev/lpuart_b/ver/sim/…/bench/top_env/base_test.sv, 49
The object at dereference depth 3 is being used before it was
constructed/allocated.
Please make sure that the object is allocated before using it.

#0 in \base_test::connect_phase at
/work/home/lliu/project/ipdev/lpuart_b/ver/sim/…/bench/top_env/base_test.sv:49
#1 in \uvm_connect_phase::exec_func at
/cadtools/synopsys/vcs_vQ-2020.03/etc/uvm/base/uvm_common_phases.svh:96
#2 in \uvm_bottomup_phase::execute at
/cadtools/synopsys/vcs_vQ-2020.03/etc/uvm/base/uvm_bottomup_phase.svh:108

How can I solve it ?

The 49 lines of base_test.sv are: v_sqr.uart_rx_sqr = env.usart_env.uart_rx_agt.rx_sqr;


`ifndef BASE_TEST_SV
`define BASE_TEST_SV

class base_test extends uvm_test;

  `uvm_component_utils(base_test)

  top_env           env;
  my_vsequencer     v_sqr;

 
  // Declare the component 
  cust_apb_master_config  apb_mst_cfg;
  cust_rcc_config  rcc_cfg;
  usart_config  usart_cfg;
  function new(string name="base_test", uvm_component parent=null);
    super.new(name,parent);
  endfunction

  virtual function void build_phase(uvm_phase phase);

    super.build_phase(phase);

    v_sqr = my_vsequencer::type_id::create("v_sqr",this);
    env   = top_env::type_id::create("env",this);

    // Construct the component
    apb_mst_cfg = cust_apb_master_config::type_id::create("apb_mst_cfg",this);
    uvm_config_db#(cust_apb_master_config)::set(this,"env.apb_mst_env","cust_apb_master_config",this.apb_mst_cfg);
    rcc_cfg = cust_rcc_config::type_id::create("rcc_cfg",this);
    uvm_config_db#(cust_rcc_config)::set(this,"env.rcc_env","cust_rcc_config",this.rcc_cfg);

    usart_cfg = usart_config::type_id::create("usart_cfg",this);
    uvm_config_db #(usart_config)::set(this,"env.usart_env","usart_config",usart_cfg);

  endfunction

  function void connect_phase(uvm_phase phase);

    // Connect the component
    v_sqr.apb_mst_sqr = env.apb_mst_env.apb_system_env.master.sequencer;
    v_sqr.rcc_sqr = env.rcc_env.rcc_system_env.gp_agt[0].gp_sqr;

    v_sqr.uart_rx_sqr = env.usart_env.uart_rx_agt.rx_sqr;
  endfunction


The component uart_rx_agt.rx_sqr does not exist. It has not been constructed.
Check your code for the rx_sqr in the corresponding agent.