fix(ios): avoid double-initializing FLTPDFView#332
fix(ios): avoid double-initializing FLTPDFView#332muhammadbiilal wants to merge 1 commit intoendigo:masterfrom
Conversation
WalkthroughThe change modifies the iOS Flutter PDF view initialization to replace the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
ios/flutter_pdfview/Sources/flutter_pdfview/FlutterPDFView.m (1)
114-117: Critical: Missing[super initWithFrame:frame]call inFLTPDFView.The
initWithFrame:arguments:controller:method sets instance variables and returnsselfwithout ever calling the superclass initializer. SinceFLTPDFViewis aUIViewsubclass (it callsaddSubview:on line 244), you must call[super initWithFrame:frame]to properly initialize the view hierarchy.Without this, the UIView is left in an undefined state, which could cause crashes or undefined behavior—especially on newer iOS versions with trait collection initialization.
🐛 Proposed fix
- (instancetype)initWithFrame:(CGRect)frame arguments:(id _Nullable)args controller:(nonnull FLTPDFViewController *)controller { + self = [super initWithFrame:frame]; + if (!self) return nil; + _controller = controller;
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.