mirror of
https://github.com/MatomoCamp/matomocamp-companion-android.git
synced 2024-09-19 16:13:46 +02:00
Prevent the app from crashing when trying to launch an invalid link or when no browser is installed.
This commit is contained in:
parent
63f3f28bfa
commit
4aa734ca3b
2 changed files with 17 additions and 4 deletions
|
@ -503,8 +503,14 @@ public class EventDetailsFragment extends Fragment {
|
|||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(link.getUrl()));
|
||||
String url = link.getUrl();
|
||||
if (url != null) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
try {
|
||||
v.getContext().startActivity(intent);
|
||||
} catch (ActivityNotFoundException ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package be.digitalia.fosdem.fragments;
|
||||
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
|
@ -57,8 +58,14 @@ public class PersonInfoListFragment extends RecyclerViewFragment implements Load
|
|||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.more_info:
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(person.getUrl()));
|
||||
String url = person.getUrl();
|
||||
if (url != null) {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (ActivityNotFoundException ignore) {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue