Skip to content

Commit

Permalink
Merge pull request #692 from Sequel-Ace/fix-SPTableStructure-loadTable
Browse files Browse the repository at this point in the history
#fixed sp table structure load table crash
  • Loading branch information
jamesstout committed Dec 24, 2020
2 parents 07b2d48 + 6bbdb72 commit c7cc150
Showing 1 changed file with 18 additions and 2 deletions.
Expand Up @@ -1381,8 +1381,24 @@ - (void)loadTable:(NSString *)aTable

for (NSDictionary *encoding in encodings)
{
NSString *encodingName = [encoding objectForKey:@"CHARACTER_SET_NAME"];
NSString *title = (![encoding objectForKey:@"DESCRIPTION"]) ? encodingName : [NSString stringWithFormat:@"%@ (%@)", [encoding objectForKey:@"DESCRIPTION"], encodingName];
NSString *encodingName = [encoding safeObjectForKey:@"CHARACTER_SET_NAME"];
NSString *title = (![encoding safeObjectForKey:@"DESCRIPTION"]) ? encodingName : [NSString stringWithFormat:@"%@ (%@)", [encoding safeObjectForKey:@"DESCRIPTION"], encodingName];

if(title == nil || [title isNSNull]){
SPLog(@"title is nil");
CLS_LOG(@"title is nil");

NSDictionary *userInfo = @{
NSLocalizedDescriptionKey: @"loadTable: title is nil, check CHARACTER_SET_NAME",
@"encodingName":encodingName,
@"encoding": encoding,
};

// default to empty string?
title = @"";

[FIRCrashlytics.crashlytics recordError:[NSError errorWithDomain:@"database" code:7 userInfo:userInfo]];
}

[self->encodingPopupCell addItemWithTitle:title];
NSMenuItem *item = [self->encodingPopupCell lastItem];
Expand Down

0 comments on commit c7cc150

Please sign in to comment.