File tree Expand file tree Collapse file tree 4 files changed +5
-5
lines changed Expand file tree Collapse file tree 4 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ void FullScreenLayout::DoLayout(CDCHandle dc)
59
59
_auxiliaryRect.OffsetRect (offsetX, offsetY);
60
60
_highlightRect = m_layout->GetHighlightRect ();
61
61
_highlightRect.OffsetRect (offsetX, offsetY);
62
- for (int i = 0 , n = (int )_context.cinfo .candies .size (); i < n; ++i)
62
+ for (int i = 0 , n = (int )_context.cinfo .candies .size (); i < n && i < MAX_CANDIDATES_COUNT ; ++i)
63
63
{
64
64
_candidateLabelRects[i] = m_layout->GetCandidateLabelRect (i);
65
65
_candidateLabelRects[i].OffsetRect (offsetX, offsetY);
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ void HorizontalLayout::DoLayout(CDCHandle dc)
40
40
41
41
/* Candidates */
42
42
int w = _style.margin_x , h = 0 ;
43
- for (size_t i = 0 ; i < candidates.size (); i++ )
43
+ for (size_t i = 0 ; i < candidates.size () && i < MAX_CANDIDATES_COUNT; ++i )
44
44
{
45
45
if (i > 0 )
46
46
w += _style.candidate_spacing ;
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ void VerticalLayout::DoLayout(CDCHandle dc)
42
42
int comment_shift_width = 0 ; /* distance to the left of the candidate text */
43
43
int max_candidate_width = 0 ; /* label + text */
44
44
int max_comment_width = 0 ; /* comment, or none */
45
- for (size_t i = 0 ; i < candidates.size (); i++ )
45
+ for (size_t i = 0 ; i < candidates.size () && i < MAX_CANDIDATES_COUNT; ++i )
46
46
{
47
47
if (i > 0 )
48
48
height += _style.candidate_spacing ;
@@ -86,7 +86,7 @@ void VerticalLayout::DoLayout(CDCHandle dc)
86
86
width = max (width, max_content_width + 2 * _style.margin_x );
87
87
88
88
/* Align comments */
89
- for (size_t i = 0 ; i < candidates.size (); i++ )
89
+ for (size_t i = 0 ; i < candidates.size () && i < MAX_CANDIDATES_COUNT; ++i )
90
90
_candidateCommentRects[i].OffsetRect (_style.margin_x + comment_shift_width, 0 );
91
91
92
92
if (candidates.size ())
Original file line number Diff line number Diff line change @@ -215,7 +215,7 @@ bool WeaselPanel::_DrawCandidates(CDCHandle dc)
215
215
const std::vector<Text> &comments (m_ctx.cinfo .comments );
216
216
const std::vector<Text> &labels (m_ctx.cinfo .labels );
217
217
218
- for (size_t i = 0 ; i < candidates.size (); i++ )
218
+ for (size_t i = 0 ; i < candidates.size () && i < MAX_CANDIDATES_COUNT; ++i )
219
219
{
220
220
CRect rect;
221
221
if (i == m_ctx.cinfo .highlighted )
You can’t perform that action at this time.
0 commit comments