ext: Fix segfault in simulate_limit_event shortcut

In the SST integration the top of the main queue is checked
for an event before starting the simulation.

If the first event is scheduled after the ending tick, we are
just returning the simulate_limit_event without entering
the simulation loop.

If the method is called with an empty queue, the following
line will segfault (getHead() == nullptr):

gem5::mainEventQueue[0]->getHead()->when()

With this patch we are covering the case where we have
an empty event queue

Change-Id: I04463b45b269361172a9dd2fe1ba6e9428ac64f5
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/53723
Reviewed-by: Hoa Nguyen <hoanguyen@ucdavis.edu>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
1 file changed