Don't crash when user clicks Anti-feature link without browser

This commit is contained in:
Torsten Grote
2025-05-07 14:35:47 -03:00
committed by Hans-Christoph Steiner
parent 7741ac9b57
commit e7fe0796be

View File

@@ -18,6 +18,7 @@
package org.fdroid.fdroid.views.appdetails;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
@@ -28,6 +29,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
@@ -106,7 +108,13 @@ public class AntiFeaturesListingView extends RecyclerView {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
i.setData(Uri.parse("https://f-droid.org/docs/Anti-Features#" + antiFeatureId));
getContext().startActivity(i);
try {
getContext().startActivity(i);
} catch (ActivityNotFoundException ex) {
Toast.makeText(getContext(),
getContext().getString(R.string.no_handler_app, antiFeatureId),
Toast.LENGTH_LONG).show();
}
});
}