From: Jean-Marc Lasgouttes Date: Wed, 7 Sep 2005 09:44:58 +0000 (+0000) Subject: fix crash when ${HOME} is empty X-Git-Tag: 1.6.10~13943 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=742ff585a2ec404a5a7d9731edc726ebf958cb49;p=features.git fix crash when ${HOME} is empty git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10419 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/support/ChangeLog b/src/support/ChangeLog index 351106a23b..7e2dfa2791 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,9 @@ +2005-08-31 Jean-Marc Lasgouttes + + * 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 * package.C.in: @@ -6,9 +12,10 @@ 2005-07-14 Angus Leeming * 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 diff --git a/src/support/filetools.C b/src/support/filetools.C index e7c3174b23..149448c9c8 100644 --- a/src/support/filetools.C +++ b/src/support/filetools.C @@ -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) diff --git a/src/support/lstrings.C b/src/support/lstrings.C index 7a551ac02b..7d58d73b54 100644 --- a/src/support/lstrings.C +++ b/src/support/lstrings.C @@ -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();