From 63ca187aa73f2e51bfeccb85b313890d674d8c09 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Thu, 7 Jul 2022 16:37:42 -0700 Subject: [PATCH] [Table Views] Add a safety check to cell creation Cell creation may create some other type of view, somehow. No idea how. Signed-off-by: Christopher Snowhill --- Playlist/PlaylistController.m | 2 +- Preferences/Preferences/GeneralPane.m | 2 +- Preferences/Preferences/PathSuggester.m | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Playlist/PlaylistController.m b/Playlist/PlaylistController.m index e0589225b..043278499 100644 --- a/Playlist/PlaylistController.m +++ b/Playlist/PlaylistController.m @@ -495,7 +495,7 @@ static void *playlistControllerContext = &playlistControllerContext; } NSView *view = [tableView makeViewWithIdentifier:cellIdentifier owner:nil]; - if(view) { + if(view && [view isKindOfClass:[NSTableCellView class]]) { NSTableCellView *cellView = (NSTableCellView *)view; NSRect frameRect = cellView.frame; frameRect.origin.y = 1; diff --git a/Preferences/Preferences/GeneralPane.m b/Preferences/Preferences/GeneralPane.m index 2d21b3315..b1a3adce0 100644 --- a/Preferences/Preferences/GeneralPane.m +++ b/Preferences/Preferences/GeneralPane.m @@ -67,7 +67,7 @@ } NSView *view = [tableView makeViewWithIdentifier:cellIdentifier owner:nil]; - if(view) { + if(view && [view isKindOfClass:[NSTableCellView class]]) { NSTableCellView *cellView = (NSTableCellView *)view; if(cellView.textField) { diff --git a/Preferences/Preferences/PathSuggester.m b/Preferences/Preferences/PathSuggester.m index b0c7661fa..b02ba1e3b 100644 --- a/Preferences/Preferences/PathSuggester.m +++ b/Preferences/Preferences/PathSuggester.m @@ -153,7 +153,7 @@ } NSView *view = [tableView makeViewWithIdentifier:cellIdentifier owner:nil]; - if(view) { + if(view && [view isKindOfClass:[NSTableCellView class]]) { NSTableCellView *cellView = (NSTableCellView *)view; if(cellView.textField) {