Skip to content

Commit 43926b0

Browse files
committed
Add a check for table comment being NULL
(which can’t normally happen with MySQL, but I guess not every installation out there is normal) (#2791)
1 parent 8fcdb7b commit 43926b0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: Source/SPExtendedTableInfo.m

+3-2
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,8 @@ - (void)loadTable:(NSString *)table
404404
[tableSizeFree setStringValue:[self _formatValueWithKey:SPMySQLDataFreeField inDictionary:statusFields]];
405405

406406
// Set comments
407-
NSString *commentText = [statusFields objectForKey:SPMySQLCommentField];
407+
// Note: On MySQL the comment column is marked as NOT NULL, but we still received crash reports because it was NULL!? (#2791)
408+
NSString *commentText = [[statusFields objectForKey:SPMySQLCommentField] unboxNull];
408409

409410
if (!commentText) commentText = @"";
410411

@@ -541,7 +542,7 @@ - (void)textDidEndEditing:(NSNotification *)notification
541542

542543
if ((object == tableCommentsTextView) && ([object isEditable]) && ([selectedTable length] > 0)) {
543544

544-
NSString *currentComment = [[tableDataInstance statusValueForKey:@"Comment"] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
545+
NSString *currentComment = [[[tableDataInstance statusValueForKey:SPMySQLCommentField] unboxNull] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
545546
NSString *newComment = [[tableCommentsTextView string] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
546547

547548
// Check that the user actually changed the tables comment

0 commit comments

Comments
 (0)