Error-[NOA] Null object access. set_drain_time in different phases

Hello, so I am just learning UVM and I thought that you can declare set_drain_time in both start_of_simulation_phase(…) and run_phase(…), but if I declare my set_drain_time in the start_of_simulation_phase, it will give me a Null Object access.

This is the full error message:
Error-[NOA] Null object access
…/ex07/, 40
The object at dereference depth 0 is being used before it was
Please make sure that the object is allocated before using it.

Here are my start_of_simulation_phase and run_phase:

  // Set some drain time before ending the simulation
  // function void start_of_simulation_phase(uvm_phase phase);
  //     uvm_objection obj = phase.get_objection();
  //     obj.set_drain_time( this, 100ns );      // <- Line 40 is referring to this
  // endfunction : start_of_simulation_phase

  task run_phase(uvm_phase phase);
    serial_sequence seq;
    uvm_objection obj = phase.get_objection();    // If I comment this line and the line below out, and put these
    obj.set_drain_time( this, 100ns );            // into the start_of_simulation_phase, I get the error

    seq = serial_sequence::type_id::create();
    if (m_env.m_serial_agent.m_sequencer != null)

  endtask : run_phase

My take is that obj has not being constructed in the start_of_simulation_phase, but where is that obj being constructed at all?
What could be the reason to this?

In reply to jimmyhuang0904:

Objections get constructed only for the time-consuming task based phases. the start_of_simulation_phase is a function and executes in 0 time.