From f7b644457f346c2cfe0852d05cd4d3a76e4fdcbe Mon Sep 17 00:00:00 2001 From: Bryce Hackel <34104885+bhackel@users.noreply.github.com> Date: Wed, 3 Apr 2024 12:19:56 -0700 Subject: [PATCH] Fix crash --- Sources/uYouPlus.xm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/uYouPlus.xm b/Sources/uYouPlus.xm index 1603f64..9039473 100644 --- a/Sources/uYouPlus.xm +++ b/Sources/uYouPlus.xm @@ -281,10 +281,10 @@ BOOL isAd(YTIElementRenderer *self) { - (void)layoutSubviews { %orig; // Get the badge of this cell, as it is language-independent and unique - YTIconBadgeView *badgeView = self._iconBadgeView; + YTIconBadgeView *badgeView = [self valueForKey:@"_iconBadgeView"]; // First null check for badgeView if (!badgeView) { - return; // Early return if badgeView is nil + return; } // Walk down the subviews to get to a specific view UIView *subview = badgeView.subviews.firstObject; @@ -293,12 +293,12 @@ BOOL isAd(YTIElementRenderer *self) { return; } UIImageView *imageView = subview.subviews.firstObject; - // Third null check for the imageView - if (!imageView) { + // Third null/inavlid check for the imageView + if (!imageView || ![imageView respondsToSelector:@selector(description)]) { return; } // Get the description of this view - NSString *description = imageView.description; + NSString *description = [imageView description]; // Check if "yt_outline_youtube_logo_icon" is in the description if ([description containsString:@"yt_outline_youtube_logo_icon"]) { self.hidden = YES; // Hide the cell