Skip to content

Commit

Permalink
fix(ios): guard source property and removed NSNull if it is nil (#11243)
Browse files Browse the repository at this point in the history
Fixes TIMOB-27354
  • Loading branch information
vijaysingh-axway authored and sgtcoolguy committed Oct 3, 2019
1 parent ca3f3e3 commit 44074a8
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions iphone/TitaniumKit/TitaniumKit/Sources/API/TiApp.m
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,12 @@ - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDiction
[launchOptions setObject:[url absoluteString] forKey:@"url"];
[launchOptions removeObjectForKey:UIApplicationLaunchOptionsSourceApplicationKey];

[launchOptions setObject:[options objectForKey:UIApplicationOpenURLOptionsSourceApplicationKey] ?: [NSNull null] forKey:@"source"];
id source = [options objectForKey:UIApplicationOpenURLOptionsSourceApplicationKey];
if (source != nil) {
[launchOptions setObject:source forKey:@"source"];
} else {
[launchOptions removeObjectForKey:@"source"];
}

if (appBooted) {
[[NSNotificationCenter defaultCenter] postNotificationName:kTiApplicationLaunchedFromURL object:self userInfo:launchOptions];
Expand All @@ -453,7 +458,11 @@ - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceAppl
[launchOptions setObject:[url absoluteString] forKey:@"url"];
[launchOptions removeObjectForKey:UIApplicationLaunchOptionsSourceApplicationKey];

[launchOptions setObject:sourceApplication ?: [NSNull null] forKey:@"source"];
if (sourceApplication != nil) {
[launchOptions setObject:sourceApplication forKey:@"source"];
} else {
[launchOptions removeObjectForKey:@"source"];
}

if (appBooted) {
[[NSNotificationCenter defaultCenter] postNotificationName:kTiApplicationLaunchedFromURL object:self userInfo:launchOptions];
Expand Down

0 comments on commit 44074a8

Please sign in to comment.