From 049cd56215467ea1c7ae15ecb0c4a5ea301dbe06 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 2 May 2014 21:19:20 -0400 Subject: [PATCH] if it is not possible to make the sharing Uri, return a placeholder The receiver of this can at least make some sense of it, versus null or a blank string. This prevents crashes where FDroid.repo.address is not yet set since the wifi was never enabled or it does not have an IP address yet. --- src/org/fdroid/fdroid/Utils.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/org/fdroid/fdroid/Utils.java b/src/org/fdroid/fdroid/Utils.java index a9e4ec1b9..39edc418e 100644 --- a/src/org/fdroid/fdroid/Utils.java +++ b/src/org/fdroid/fdroid/Utils.java @@ -193,6 +193,8 @@ public final class Utils { } public static Uri getSharingUri(Context context, Repo repo) { + if (TextUtils.isEmpty(repo.address)) + return Uri.parse("http://wifi-not-enabled"); Uri uri = Uri.parse(repo.address.replaceFirst("http", "fdroidrepo")); Uri.Builder b = uri.buildUpon(); b.appendQueryParameter("fingerprint", repo.fingerprint);