don't call top on an empty stack

Fixes CppunitTest_sax_parser crash in a dbgutil build.

Change-Id: Ibe4b4d3785535816b40d46fd0baa60f01e1f9d33
Reviewed-on: https://gerrit.libreoffice.org/7267
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>