Skip to content

Commit

Permalink
Fix a few crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
c99koder committed Jul 25, 2024
1 parent 7248f9f commit 7397afe
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions IRCCloud/Classes/LogExportsTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,8 @@ -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Delete Download" message:[[NSUserDefaults standardUserDefaults] boolForKey:@"iCloudLogs"]?@"Are you sure you want to delete this download? It will be removed from your device and all other devices that are syncing with iCloud Drive.":@"Are you sure you want to delete this download from your device?" preferredStyle:UIAlertControllerStyleAlert];

[alert addAction:[UIAlertAction actionWithTitle:@"Delete" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
[self->_downloadingURLs setObject:@(0) forKey:url];
if(url)
[self->_downloadingURLs setObject:@(0) forKey:url];
[self.tableView reloadData];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSFileCoordinator *coordinator = [[NSFileCoordinator alloc] initWithFilePresenter:nil];
Expand All @@ -611,7 +612,8 @@ -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *
[self refresh:[NSKeyedUnarchiver unarchivedObjectOfClass:NSDictionary.class fromData:[[NSUserDefaults standardUserDefaults] objectForKey:@"logs_cache"] error:&error]];
if(error)
CLS_LOG(@"Error: %@", error);
[self->_downloadingURLs removeObjectForKey:url];
if(url)
[self->_downloadingURLs removeObjectForKey:url];
[self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:YES];
[self performSelectorOnMainThread:@selector(refresh) withObject:nil waitUntilDone:YES];
}];
Expand Down
3 changes: 3 additions & 0 deletions IRCCloud/UIExpandingTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ - (void)textViewDidChange:(UITextView *)textView
placeholderLabel.alpha = 0;
}

if(!textView.font)
return;

NSInteger newHeight = ceil([textView.text boundingRectWithSize:CGSizeMake(internalTextView.bounds.size.width - 12, maximumHeight) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:textView.font} context:nil].size.height) + 17;

if(newHeight < minimumHeight || !internalTextView.hasText)
Expand Down
2 changes: 1 addition & 1 deletion build-scripts/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1 @@
348
350

0 comments on commit 7397afe

Please sign in to comment.