Catch IllegalArgumentException from startActivity

This commit is contained in:
Fredrik Fornwall
2016-03-01 16:33:22 +01:00
parent 6ca055bb25
commit 46c9c4b80e

View File

@@ -736,7 +736,9 @@ public final class TermuxActivity extends Activity implements ServiceConnection
stylingIntent.setClassName("com.termux.styling", "com.termux.styling.TermuxStyleActivity"); stylingIntent.setClassName("com.termux.styling", "com.termux.styling.TermuxStyleActivity");
try { try {
startActivity(stylingIntent); startActivity(stylingIntent);
} catch (ActivityNotFoundException e) { } catch (ActivityNotFoundException | IllegalArgumentException e) {
// The startActivity() call is not documented to throw IllegalArgumentException.
// However, crash reporting shows that it sometimes does, so catch it here.
new AlertDialog.Builder(this).setMessage(R.string.styling_not_installed) new AlertDialog.Builder(this).setMessage(R.string.styling_not_installed)
.setPositiveButton(R.string.styling_install, new android.content.DialogInterface.OnClickListener() { .setPositiveButton(R.string.styling_install, new android.content.DialogInterface.OnClickListener() {
@Override @Override