Merge lp:~macslow/unity/unity-4.0.fix-834630 into lp:unity/4.0

Proposed by Mirco Müller
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 1719
Proposed branch: lp:~macslow/unity/unity-4.0.fix-834630
Merge into: lp:unity/4.0
Diff against target: 13 lines (+3/-0)
1 file modified
plugins/unityshell/src/SwitcherModel.cpp (+3/-0)
To merge this branch: bzr merge lp:~macslow/unity/unity-4.0.fix-834630
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Review via email: mp+80471@code.launchpad.net

Description of the change

Add an out-of-bounds check to the DetailXids vector. Fixes LP: #834630

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

I think it would be slightly clearer with:
  if (detail_selection_index >= DetailXids().size())
rather than:
  if (detail_selection_index > DetailXids().size() - 1)

as normally when looping you have
  while (index < size)
and the opposite of < is >=

What do you think?

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/SwitcherModel.cpp'
2--- plugins/unityshell/src/SwitcherModel.cpp 2011-09-19 16:36:21 +0000
3+++ plugins/unityshell/src/SwitcherModel.cpp 2011-10-26 15:50:21 +0000
4@@ -132,6 +132,9 @@
5 {
6 if (!detail_selection || DetailXids ().empty())
7 return 0;
8+
9+ if (detail_selection_index > DetailXids().size() - 1)
10+ return 0;
11
12 return DetailXids()[detail_selection_index];
13 }

Subscribers

People subscribed via source and target branches

to all changes: