From 43926b0d48a341335538bb7b368c3fa4a73ddadb Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 17 May 2017 23:44:35 +0200 Subject: Add a check for table comment being NULL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (which can’t normally happen with MySQL, but I guess not every installation out there is normal) (#2791) --- Source/SPExtendedTableInfo.m | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Source') diff --git a/Source/SPExtendedTableInfo.m b/Source/SPExtendedTableInfo.m index df084bf3..dc311bdf 100644 --- a/Source/SPExtendedTableInfo.m +++ b/Source/SPExtendedTableInfo.m @@ -404,7 +404,8 @@ static NSString *SPMySQLCommentField = @"Comment"; [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 @@ static NSString *SPMySQLCommentField = @"Comment"; 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 -- cgit v1.2.3