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.
This commit is contained in:
Hans-Christoph Steiner 2014-05-02 21:19:20 -04:00
parent 1d1c682c2c
commit 049cd56215

View File

@ -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);