[app] don't crash on invalid repo URLs

Fixes acra-crash-reports#218
This commit is contained in:
Torsten Grote 2023-03-07 10:26:33 -03:00 committed by Hans-Christoph Steiner
parent 00b68f0442
commit 8d61de333b
1 changed files with 10 additions and 2 deletions

View File

@ -232,10 +232,18 @@ public class ManageReposActivity extends AppCompatActivity implements RepoAdapte
try {
new URL(text);
Uri uri = Uri.parse(text);
fingerprint = uri.getQueryParameter("fingerprint");
try {
fingerprint = uri.getQueryParameter("fingerprint");
} catch (UnsupportedOperationException e) {
Log.e(TAG, "Error getting fingerprint ", e);
}
// uri might contain a QR-style, all uppercase URL:
if (TextUtils.isEmpty(fingerprint)) {
fingerprint = uri.getQueryParameter("FINGERPRINT");
try {
fingerprint = uri.getQueryParameter("FINGERPRINT");
} catch (UnsupportedOperationException e) {
Log.e(TAG, "Error getting fingerprint ", e);
}
}
String userInfo = uri.getUserInfo();