RoomViewController: Fix a crash when setting a nil string on UIPasteboard.

This commit is contained in:
SBiOSoftWhare
2019-10-21 17:36:58 +02:00
parent 07d5e27de3
commit 40383657a7

View File

@@ -2677,8 +2677,14 @@
// Create a matrix.to permalink that is common to all matrix clients
NSString *permalink = [MXTools permalinkToEvent:selectedEvent.eventId inRoom:selectedEvent.roomId];
// Create a room matrix.to permalink
[[UIPasteboard generalPasteboard] setString:permalink];
if (permalink)
{
[[UIPasteboard generalPasteboard] setString:permalink];
}
else
{
NSLog(@"[RoomViewController] Contextual menu permalink action failed. Permalink is nil.");
}
}
}]];
@@ -5278,7 +5284,14 @@
}
NSString *textMessage = selectedComponent.textMessage;
[UIPasteboard generalPasteboard].string = textMessage;
if (textMessage)
{
[UIPasteboard generalPasteboard].string = textMessage;
}
else
{
NSLog(@"[RoomViewController] Contextual menu copy failed. Text is nil.");
}
[self hideContextualMenuAnimated:YES];
}