Calling back() and pop_back() on the empty string is undefined
behavior [1,2].
The issue manifested itself as an uncaught std::out_of_range exception
when running clangd compiled on RHEL7 using devtoolset-9.
[1] https://en.cppreference.com/w/cpp/string/basic_string/back
[2] https://en.cppreference.com/w/cpp/string/basic_string/pop_back
Fixes: 1ff7c32fc91c607b690d4bb9cf42f406be8dde68