From ec2c38b2d808c46207aebb0c8642ecc42f641bc5 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Wed, 22 Apr 2009 02:55:17 +0000 Subject: Avoid pointing at uninitialized memory as this triggered BoundsChecker. --- src/Editor.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Editor.cxx b/src/Editor.cxx index 580e2baa3..3e8cb21fc 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1515,15 +1515,15 @@ static int WidthStyledText(Surface *surface, ViewStyle &vs, int styleOffset, } static int WidestLineWidth(Surface *surface, ViewStyle &vs, int styleOffset, const StyledText &st) { - const char *styles = st.styles; + size_t styleStart = 0; LineEnumerator le(st.text, st.length); int widthMax = 0; while (!le.Finished()) { LineSegment ls = le.Next(); int widthSubLine; if (st.multipleStyles) { - widthSubLine = WidthStyledText(surface, vs, styleOffset, ls.s, styles, ls.len); - styles += ls.len + 1; + widthSubLine = WidthStyledText(surface, vs, styleOffset, ls.s, st.styles + styleStart, ls.len); + styleStart += ls.len + 1; } else { widthSubLine = surface->WidthText(vs.styles[styleOffset + st.style].font, ls.s, ls.len); } -- cgit v1.2.3