core: fix segv when poping last element

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>