Merge pull request #1713 from vector-im/fix_crash

Bug Fix: App crashes when the user taps on a bubble in which a string…
This commit is contained in:
giomfo 2017-12-28 18:21:03 +01:00 committed by GitHub
commit 108d876234
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -181,7 +181,7 @@ static NSAttributedString *readReceiptVerticalWhitespace = nil;
{ {
// Check whether another component than this one is selected // Check whether another component than this one is selected
// Note: When a component is selected, it is highlighted by applying an alpha on other components. // Note: When a component is selected, it is highlighted by applying an alpha on other components.
if (selectedComponentIndex != NSNotFound && selectedComponentIndex != index) if (selectedComponentIndex != NSNotFound && selectedComponentIndex != index && componentString.length)
{ {
// Apply alpha to blur this component // Apply alpha to blur this component
NSMutableAttributedString *customComponentString = [[NSMutableAttributedString alloc] initWithAttributedString:componentString]; NSMutableAttributedString *customComponentString = [[NSMutableAttributedString alloc] initWithAttributedString:componentString];
@ -226,7 +226,7 @@ static NSAttributedString *readReceiptVerticalWhitespace = nil;
[currentAttributedTextMsg appendAttributedString:[MXKRoomBubbleCellDataWithAppendingMode messageSeparator]]; [currentAttributedTextMsg appendAttributedString:[MXKRoomBubbleCellDataWithAppendingMode messageSeparator]];
// Check whether another component than this one is selected // Check whether another component than this one is selected
if (selectedComponentIndex != NSNotFound && selectedComponentIndex != index) if (selectedComponentIndex != NSNotFound && selectedComponentIndex != index && componentString.length)
{ {
// Apply alpha to blur this component // Apply alpha to blur this component
NSMutableAttributedString *customComponentString = [[NSMutableAttributedString alloc] initWithAttributedString:componentString]; NSMutableAttributedString *customComponentString = [[NSMutableAttributedString alloc] initWithAttributedString:componentString];