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 Sep 13, 2023
1 parent 5964435 commit b01683f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
7 changes: 6 additions & 1 deletion IRCCloud/Classes/EventsDataSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ @implementation Event
+ (BOOL)supportsSecureCoding {
return YES;
}
-(instancetype)init {
self = [super init];
self->_type = (NSString *)[[NSNull alloc] init];
return self;
}
-(NSComparisonResult)compare:(Event *)aEvent {
if(aEvent.pending && !_pending)
return NSOrderedAscending;
Expand Down Expand Up @@ -57,7 +62,7 @@ -(BOOL)isImportant:(NSString *)bufferType {
if(!from.length)
from = self->_nick;

if([ignore match:[NSString stringWithFormat:@"%@!%@",from,self->_hostmask]])
if(from != nil && self->_hostmask != nil && [ignore match:[NSString stringWithFormat:@"%@!%@",from,self->_hostmask]])
return NO;
}

Expand Down
5 changes: 4 additions & 1 deletion IRCCloud/Classes/MainViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -5473,7 +5473,10 @@ -(void)paste:(id)sender {
if([UIPasteboard generalPasteboard].hasImages && ![UIPasteboard generalPasteboard].hasURLs) {
for(NSString *type in [UIPasteboard generalPasteboard].pasteboardTypes) {
if([type isEqualToString:(__bridge NSString *)kUTTypeGIF] && [UIPasteboard generalPasteboard].image) {
[self _imagePickerController:[UIImagePickerController new] didFinishPickingMediaWithInfo:@{UIImagePickerControllerOriginalImage:[UIPasteboard generalPasteboard].image, @"gifData":[[UIPasteboard generalPasteboard] dataForPasteboardType:(__bridge NSString *)kUTTypeGIF]}];
UIImage *img = [UIPasteboard generalPasteboard].image;
NSData *gifData = [[UIPasteboard generalPasteboard] dataForPasteboardType:(__bridge NSString *)kUTTypeGIF];
if(img != nil && gifData != nil)
[self _imagePickerController:[UIImagePickerController new] didFinishPickingMediaWithInfo:@{UIImagePickerControllerOriginalImage:img, @"gifData":gifData}];
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion IRCCloud/Classes/NetworkConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -2135,7 +2135,7 @@ -(void)clearPrefs {
}

-(void)webSocketDidOpen:(WebSocket *)socket {
if(socket == self->_socket) {
if(socket == self->_socket && self.session != nil) {
CLS_LOG(@"Socket connected");
self->_idleInterval = 20;
self->_reconnectTimestamp = -1;
Expand Down
4 changes: 4 additions & 0 deletions ShareExtension/ShareViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ - (void)didSelectPost {
NSExtensionItem *output = [input copy];
output.attributedContentText = [[NSAttributedString alloc] initWithString:self.contentText attributes:nil];

if(self->_buffer == nil || self->_buffer.name == nil) {
return;
}

if(output.attachments.count) {
if(self->_fileUploader.originalFilename) {
NSLog(@"Setting filename, bid, and message for IRCCloud upload");
Expand Down
2 changes: 1 addition & 1 deletion build-scripts/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1 @@
335
337

0 comments on commit b01683f

Please sign in to comment.