From 60cf37471dbcbb36b0d7f9ec8a6994350ba22424 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Wed, 8 Nov 2006 11:32:33 +0000 Subject: [PATCH] Fix potential crash. Passing an empty string happens _very_ often. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15803 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiFontMetrics.C | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/frontends/qt4/GuiFontMetrics.C b/src/frontends/qt4/GuiFontMetrics.C index 0a1138bfb5..d1ed0ecea8 100644 --- a/src/frontends/qt4/GuiFontMetrics.C +++ b/src/frontends/qt4/GuiFontMetrics.C @@ -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