diff options
author | Ilya Grechuhin <i.grechuhin@gmail.com> | 2017-02-16 13:23:21 +0300 |
---|---|---|
committer | Sergey Yershov <syershov@maps.me> | 2017-02-16 14:57:01 +0300 |
commit | 3b310a71fc957d4955c55803ddec5a0350230a61 (patch) | |
tree | 17975661b51b76643e1bb3eed70b6c003b090cd9 | |
parent | 91a5d7d6d7ecfc321428b235deb2c6315e2413bc (diff) |
[xc-scheme] [ios] Fixed crash.beta-632
-rw-r--r-- | iphone/Maps/UI/BottomMenu/MWMBottomMenuViewController.mm | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/iphone/Maps/UI/BottomMenu/MWMBottomMenuViewController.mm b/iphone/Maps/UI/BottomMenu/MWMBottomMenuViewController.mm index 2adca8d8c8..ca413abc26 100644 --- a/iphone/Maps/UI/BottomMenu/MWMBottomMenuViewController.mm +++ b/iphone/Maps/UI/BottomMenu/MWMBottomMenuViewController.mm @@ -177,15 +177,26 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) { dateStyle:NSDateFormatterNoStyle timeStyle:NSDateFormatterShortStyle]; } - self.distanceLabel.text = info.targetDistance; - self.distanceLegendLabel.text = info.targetUnits; - NSMutableAttributedString * distance = - [[NSMutableAttributedString alloc] initWithString:info.targetDistance - attributes:routingNumberAttributes]; - [distance - appendAttributedString:[[NSAttributedString alloc] initWithString:info.targetUnits - attributes:routingLegendAttributes]]; - self.distanceWithLegendLabel.attributedText = distance; + NSString * targetDistance = info.targetDistance; + NSMutableAttributedString * distance; + if (targetDistance) + { + self.distanceLabel.text = targetDistance; + distance = [[NSMutableAttributedString alloc] initWithString:targetDistance + attributes:routingNumberAttributes]; + } + + NSString * targetUnits = info.targetUnits; + if (targetUnits) + { + self.distanceLegendLabel.text = targetUnits; + if (distance) + { + [distance appendAttributedString:[[NSAttributedString alloc] initWithString:targetUnits + attributes:routingLegendAttributes]]; + self.distanceWithLegendLabel.attributedText = distance; + } + } NSString * currentSpeed = info.speed ?: @"0"; self.speedLabel.text = currentSpeed; |