#include <stack>
-#ifdef HAVE_LOCALE
-#endif
-
using std::ostream;
using std::stack;
using std::vector;
for (; pit != pend; ++pit) {
LyXLayout_ptr const & style = pit->layout();
// treat <toc> as a special case for compatibility with old code
- if (pit->isInset(0)) {
+ if (!pit->empty() && pit->isInset(0)) {
InsetBase const * inset = pit->getInset(0);
if (inset->lyxCode() == InsetOld::TOC_CODE) {
string const temp = "toc";