fix crash when ${HOME} is empty

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@10420 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2005-09-07 09:46:41 +00:00
parent dc87093629
commit cbdc09aa68
4 changed files with 13 additions and 3 deletions

View 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-12 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* package.C (get_default_user_support_dir): for windows and osx

View File

@ -1324,7 +1324,7 @@ string const MakeDisplayPath(string const & path, unsigned int threshold)
string const home(lyx::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)

View File

@ -463,7 +463,7 @@ string const subst(string const & a, char oldchar, char newchar)
string const subst(string const & a,
char const * oldstr, string const & newstr)
{
lyx::Assert(oldstr);
lyx::Assert(oldstr && oldstr[0]);
string lstr(a);
string::size_type i = 0;
@ -480,6 +480,8 @@ string const subst(string const & a,
string const subst(string const & a,
string const & oldstr, string const & newstr)
{
lyx::Assert(!oldstr.empty());
string lstr(a);
string::size_type i = 0;
string::size_type const olen = oldstr.length();

View File

@ -44,9 +44,11 @@ What's new
- Enable TeXFiles.sh to run when its path contains spaces.
- Fix crash when trying to display current directory and ${HOME} is empty.
* Configuration/Installation:
- compile without STL compatibilty support, since some systems do that
- compile without STL compatibility support, since some systems do that
by default (Slackware, for ex.). [Qt only]
- enable compilation of LyX on DragonFly BSD.