fix(Tracking): add null check

This commit is contained in:
FineFindus 2024-07-19 20:43:43 +02:00
parent 72d486e992
commit 499baeb496
No known key found for this signature in database
GPG Key ID: 64873EE210FF8E6B
1 changed files with 17 additions and 14 deletions

View File

@ -4,6 +4,7 @@ import android.net.Uri;
import android.util.Patterns; import android.util.Patterns;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.Arrays; import java.util.Arrays;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@ -63,6 +64,8 @@ public class Tracking{
@NonNull @NonNull
public static String removeTrackingParameters(@NonNull String url){ public static String removeTrackingParameters(@NonNull String url){
Uri uri=Uri.parse(url); Uri uri=Uri.parse(url);
if(uri==null)
return url;
Uri.Builder uriBuilder=uri.buildUpon().clearQuery(); Uri.Builder uriBuilder=uri.buildUpon().clearQuery();
// Iterate over existing parameters and add them back if they are not tracking parameters // Iterate over existing parameters and add them back if they are not tracking parameters