]> git.lyx.org Git - features.git/commitdiff
fix crash when ${HOME} is empty
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 7 Sep 2005 09:44:58 +0000 (09:44 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 7 Sep 2005 09:44:58 +0000 (09:44 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10419 a592a061-630c-0410-9148-cb99ea01b6c8

src/support/ChangeLog
src/support/filetools.C
src/support/lstrings.C

index 351106a23b209678633454dc5d125cdee27d03d5..7e2dfa27910fa08d48621995d83ae5e12b4c9d93 100644 (file)
@@ -1,3 +1,9 @@
+2005-08-31  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * filetools.C (MakeDisplayPath): fix bug when HOME is empty.
+
+       * lstrings.C (subst): the string to be replaced should not be empty.
+
 2005-07-17  Michael Schmitt  <michael.schmitt@teststep.org>
 
        * package.C.in:
@@ -6,9 +12,10 @@
 2005-07-14  Angus Leeming  <leeming@lyx.org>
 
        * filename.[Ch] (mangledFilename): add an optional "dir" parameter
-       that is used to help determine the length of the mangled file name.
-       Do this because MiKTeX's YAP (version 2.4.1803) will crash if the string
-       referencing the file name in  the .dvi file is "too long". MikTeX bug:
+       that is used to help determine the length of the mangled file
+       name. Do this because MiKTeX's YAP (version 2.4.1803) will crash
+       if the string referencing the file name in the .dvi file is "too
+       long". MikTeX bug:
        http://sourceforge.net/tracker/index.php?func=detail&aid=1238065&group_id=10783&atid=110783
 
 2005-07-10  Georg Baum  <Georg.Baum@post.rwth-aachen.de>
index e7c3174b2352c746dc08989c7ea3bef382ee5cd3..149448c9c808685a7fca414a42873dbea4f5c2f2 100644 (file)
@@ -1000,7 +1000,7 @@ string const MakeDisplayPath(string const & path, unsigned int threshold)
        string const home = package().home_dir();
 
        // replace /home/blah with ~/
-       if (prefixIs(str, home))
+       if (!home.empty() && prefixIs(str, home))
                str = subst(str, home, "~");
 
        if (str.length() <= threshold)
index 7a551ac02bf074e733124461c7d5a5aa440b3234..7d58d73b54a3f4a7aa3f8b5603a36ef2e6890922 100644 (file)
@@ -353,6 +353,7 @@ string const subst(string const & a, char oldchar, char newchar)
 string const subst(string const & a,
                   string const & oldstr, string const & newstr)
 {
+       BOOST_ASSERT(!oldstr.empty());
        string lstr = a;
        string::size_type i = 0;
        string::size_type const olen = oldstr.length();