Skip to content
This repository was archived by the owner on Oct 1, 2018. It is now read-only.

Do not crash when app is opened via custom uri #127

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/android/com/nordnetab/cordova/ul/UniversalLinksPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,13 @@ private void handleIntent(Intent intent) {
*/
private ULHost findHostByUrl(Uri url) {
ULHost host = null;
final String launchHost = url.getHost().toLowerCase();
final String launchHost = url.getHost();
if (launchHost == null)
return null;
final String launchHostLc = launchHost.toLowerCase();
for (ULHost supportedHost : supportedHosts) {
if (supportedHost.getName().equals(launchHost) ||
supportedHost.getName().startsWith("*.") && launchHost.endsWith(supportedHost.getName().substring(1))) {
if (supportedHost.getName().equals(launchHostLc) ||
supportedHost.getName().startsWith("*.") && launchHostLc.endsWith(supportedHost.getName().substring(1))) {
host = supportedHost;
break;
}
Expand All @@ -218,4 +221,4 @@ private ULHost findHostByUrl(Uri url) {
}

// endregion
}
}