Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Commit 749c578

Browse files
committed
Merge pull request #55 from AgileBits/improvement/parameter-validation
[IMPROVEMENT] We now make sure that all parameneters are non nil.
2 parents a504590 + 6abce0e commit 749c578

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

OnePasswordExtension.m

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ - (BOOL)isAppExtensionAvailable {
7878

7979
- (void)findLoginForURLString:(NSString *)URLString forViewController:(UIViewController *)viewController completion:(void (^)(NSDictionary *loginDictionary, NSError *error))completion
8080
{
81+
NSAssert(URLString != nil, @"URLString must not be nil");
82+
NSAssert(viewController != nil, @"viewController must not be nil");
83+
8184
if (![self isSystemAppExtensionAPIAvailable]) {
8285
NSLog(@"Failed to findLoginForURLString, system API is not available");
8386
if (completion) {
@@ -125,6 +128,10 @@ - (void)findLoginForURLString:(NSString *)URLString forViewController:(UIViewCon
125128

126129
- (void)storeLoginForURLString:(NSString *)URLString loginDetails:(NSDictionary *)loginDetailsDict passwordGenerationOptions:(NSDictionary *)passwordGenerationOptions forViewController:(UIViewController *)viewController completion:(void (^)(NSDictionary *loginDictionary, NSError *error))completion;
127130
{
131+
NSAssert(URLString != nil, @"URLString must not be nil");
132+
NSAssert(loginDetailsDict != nil, @"loginDetailsDict must not be nil");
133+
NSAssert(viewController != nil, @"viewController must not be nil");
134+
128135
if (![self isSystemAppExtensionAPIAvailable]) {
129136
NSLog(@"Failed to storeLoginForURLString, system API is not available");
130137
if (completion) {
@@ -178,6 +185,10 @@ - (void)storeLoginForURLString:(NSString *)URLString loginDetails:(NSDictionary
178185

179186
- (void)changePasswordForLoginWithUsername:(NSString *)username andURLString:(NSString *)URLString passwordGenerationOptions:(NSDictionary *)passwordGenerationOptions forViewController:(UIViewController *)viewController completion:(void (^)(NSDictionary *loginDict, NSError *error))completion
180187
{
188+
NSAssert(username != nil, @"username must not be nil");
189+
NSAssert(URLString != nil, @"URLString must not be nil");
190+
NSAssert(viewController != nil, @"viewController must not be nil");
191+
181192
if (![self isSystemAppExtensionAPIAvailable]) {
182193
NSLog(@"Failed to changePasswordForLoginWithUsername, system API is not available");
183194
if (completion) {
@@ -230,6 +241,9 @@ - (void)changePasswordForLoginWithUsername:(NSString *)username andURLString:(NS
230241

231242
- (void)fillLoginIntoWebView:(id)webView forViewController:(UIViewController *)viewController completion:(void (^)(BOOL success, NSError *error))completion
232243
{
244+
NSAssert(webView != nil, @"webView must not be nil");
245+
NSAssert(viewController != nil, @"viewController must not be nil");
246+
233247
#ifdef __IPHONE_8_0
234248
if ([webView isKindOfClass:[UIWebView class]]) {
235249
[self fillLoginIntoUIWebView:webView webViewController:viewController completion:^(BOOL success, NSError *error) {

0 commit comments

Comments
 (0)