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
=== modified file 'plugins/unityshell/src/SwitcherModel.cpp'
--- plugins/unityshell/src/SwitcherModel.cpp 2011-09-19 16:36:21 +0000
+++ plugins/unityshell/src/SwitcherModel.cpp 2011-10-26 15:50:21 +0000
@@ -132,6 +132,9 @@
132{132{
133 if (!detail_selection || DetailXids ().empty())133 if (!detail_selection || DetailXids ().empty())
134 return 0;134 return 0;
135
136 if (detail_selection_index > DetailXids().size() - 1)
137 return 0;
135 138
136 return DetailXids()[detail_selection_index];139 return DetailXids()[detail_selection_index];
137}140}

Subscribers

People subscribed via source and target branches

to all changes: