]> git.lyx.org Git - features.git/commitdiff
fix crash in navigate menu
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 10 Sep 2002 11:50:13 +0000 (11:50 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 10 Sep 2002 11:50:13 +0000 (11:50 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5248 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/MenuBackend.C

index d22d3c724b6e20a20f55cb6c7fc40c6c1b07d7a7..52d277e58aa0c5cf8a3097c0b275304019059edd 100644 (file)
@@ -1,3 +1,8 @@
+2002-09-10  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * MenuBackend.C (expandToc): fix crash when there is no document
+       open 
+
 2002-09-10  Dekel Tsur  <dekelts@tau.ac.il>
 
        * many files: Add insetwrap.
index f3f7fff25a51573932fba928bdf8f15504efe7ba..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();