Yubico / yubikit-ios

Yubico Mobile iOS SDK - YubiKit
Apache License 2.0
195 stars 43 forks source link

‼️ didFailConnectingNFC:(NSError *_Nonnull)error causes crash #97

Closed summertian4 closed 2 years ago

summertian4 commented 2 years ago

Description

Here is a bug report.

In YKFManagerDelegate you define a didFailConnectingNFC function with _Nonnull error. But in fact, we found that in some cases it called this with nil.

@protocol YKFManagerDelegate <NSObject>

// ...

@optional
- (void)didFailConnectingNFC:(NSError *_Nonnull)error;

@end

We use the YubiKit in Swift, and because of _Nonnull definition, delegate implementers will create corresponding methods based on (NSError *_Nonnull)error; like this: Then, it will causes a crash.

error-01 error-02

How it happened

After turning on the scan, I quickly used the yubikey card to get close to the phone, and then quickly removed it. After trying a few more times, I entered the breakpoint in the first picture.

Please fix this issue.

WWSellers commented 2 years ago

Already reported in issue: https://github.com/Yubico/yubikit-ios/issues/94

fix was merged to master in https://github.com/Yubico/yubikit-ios/pull/96