From 08761b6ceece0df770ecab9585595f97f4f937a7 Mon Sep 17 00:00:00 2001 From: vincents Date: Tue, 3 Apr 2007 20:42:46 +0000 Subject: [PATCH] gtk interface: fixed range errors in underlining short cuts (bug #8602) from Colin Western git-svn-id: trunk@10861 - --- lcl/interfaces/gtk/gtkwinapi.inc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lcl/interfaces/gtk/gtkwinapi.inc b/lcl/interfaces/gtk/gtkwinapi.inc index e7744bdad3..9411cb9a36 100644 --- a/lcl/interfaces/gtk/gtkwinapi.inc +++ b/lcl/interfaces/gtk/gtkwinapi.inc @@ -3109,9 +3109,13 @@ var begin AStr := Copy(String(theLine), 1, LineLength); - if (Flags and DT_NoPrefix) <> DT_NoPrefix then - pIndex := DeleteAmpersands(aStr) - else + if (Flags and DT_NoPrefix) <> DT_NoPrefix then begin + pIndex := DeleteAmpersands(aStr); + If Length(aStr) = 0 then + Exit; { String consists of '&' only } + If pIndex > Length(aStr) then + pIndex := -1; { String ended in '&', which was deleted } + end else pIndex := -1; if TempBrush = HBRUSH(-1) then