Permalink
Browse files

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)
  • Loading branch information...
dmoagx committed May 17, 2017
1 parent 8fcdb7b commit 43926b0d48a341335538bb7b368c3fa4a73ddadb
Showing with 3 additions and 2 deletions.
  1. +3 −2 Source/SPExtendedTableInfo.m
@@ -404,7 +404,8 @@ - (void)loadTable:(NSString *)table
[tableSizeFree setStringValue:[self _formatValueWithKey:SPMySQLDataFreeField inDictionary:statusFields]];
// Set comments
NSString *commentText = [statusFields objectForKey:SPMySQLCommentField];
// Note: On MySQL the comment column is marked as NOT NULL, but we still received crash reports because it was NULL!? (#2791)
NSString *commentText = [[statusFields objectForKey:SPMySQLCommentField] unboxNull];
if (!commentText) commentText = @"";
@@ -541,7 +542,7 @@ - (void)textDidEndEditing:(NSNotification *)notification
if ((object == tableCommentsTextView) && ([object isEditable]) && ([selectedTable length] > 0)) {
NSString *currentComment = [[tableDataInstance statusValueForKey:@"Comment"] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSString *currentComment = [[[tableDataInstance statusValueForKey:SPMySQLCommentField] unboxNull] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSString *newComment = [[tableCommentsTextView string] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
// Check that the user actually changed the tables comment

0 comments on commit 43926b0

Please sign in to comment.