[MAPSME-5018,MAPSME-5019] [ios] Fixed crash with out of bounds vector index.

This commit is contained in:
Ilya Grechuhin 2017-07-18 10:23:47 +03:00 committed by r.kuznetsov
parent 903562d2d9
commit ec383f7c98

View file

@ -193,7 +193,11 @@ extern NSString * const kAlohalyticsTapEventKey;
for (UIView * v in self.buttons)
{
[v.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
auto const type = m_visibleButtons[v.tag - 1];
auto const buttonIndex = v.tag - 1;
NSAssert(buttonIndex >= 0, @"Invalid button index.");
if (buttonIndex < 0 || buttonIndex >= m_visibleButtons.size())
continue;
auto const type = m_visibleButtons[buttonIndex];
[MWMActionBarButton addButtonToSuperview:v
delegate:self
buttonType:type