]> git.lyx.org Git - lyx.git/blobdiff - src/MenuBackend.C
Rob's latest and greatest dialog tweaking.
[lyx.git] / src / MenuBackend.C
index 055924da53c899d5870954ebce5bccbea5d5315e..2af19defcbe8080f1a124e2d3e9bee3811f33c38 100644 (file)
@@ -480,6 +480,12 @@ void expandToc2(Menu & tomenu, toc::Toc const & toc_list,
 
 void expandToc(Menu & tomenu, Buffer const * buf)
 {
+       if (!buf) {
+               tomenu.add(MenuItem(MenuItem::Command,
+                                   _("No Documents Open!"), LFUN_NOACTION));
+               return;
+       }
+
        FloatList const & floats = buf->params.getLyXTextClass().floats();
        toc::TocList toc_list = toc::getTocList(buf);
        toc::TocList::const_iterator cit = toc_list.begin();
@@ -697,6 +703,8 @@ Menu const & MenuBackend::getMenu(string const & name) const
 {
        const_iterator cit = find_if(begin(), end(),
                                     lyx::compare_memfun(&Menu::name, name));
+       if (cit == end())
+               lyxerr << "No submenu named " << name << endl;
        lyx::Assert(cit != end());
        return (*cit);
 }