]> git.lyx.org Git - features.git/commitdiff
Fix potential crash. Passing an empty string happens _very_ often.
authorAbdelrazak Younes <younes@lyx.org>
Wed, 8 Nov 2006 11:32:33 +0000 (11:32 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 8 Nov 2006 11:32:33 +0000 (11:32 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15803 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiFontMetrics.C

index 0a1138bfb563de3402f7c3b856868a610cbd67b3..d1ed0ecea854108bd61b293bb2edbd171b7ce40b 100644 (file)
@@ -148,6 +148,9 @@ int GuiFontMetrics::width(QString const & ucs2) const
 
 int GuiFontMetrics::signedWidth(docstring const & s) const
 {
+       if (s.empty())
+               return 0;
+
        if (s[0] == '-')
                return -width(&(s[1]), s.length() - 1);
        else