Fix a couple crash reports

This commit is contained in:
Cameron Gutman 2019-02-05 22:51:48 -08:00
parent 233bceeece
commit 629bf5766d
2 changed files with 16 additions and 2 deletions

View File

@ -200,6 +200,14 @@ public class ShortcutTrampoline extends Activity {
protected boolean validateInput() { protected boolean validateInput() {
// Validate UUID // Validate UUID
if (uuidString == null) {
Dialog.displayDialog(ShortcutTrampoline.this,
getResources().getString(R.string.conn_error_title),
getResources().getString(R.string.scut_invalid_uuid),
true);
return false;
}
try { try {
UUID.fromString(uuidString); UUID.fromString(uuidString);
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {

View File

@ -91,14 +91,20 @@ public class AddComputerManually extends Activity {
} }
private void doAddPc(String host) { private void doAddPc(String host) {
String msg;
boolean wrongSiteLocal = false; boolean wrongSiteLocal = false;
boolean success; boolean success;
SpinnerDialog dialog = SpinnerDialog.displayDialog(this, getResources().getString(R.string.title_add_pc), SpinnerDialog dialog = SpinnerDialog.displayDialog(this, getResources().getString(R.string.title_add_pc),
getResources().getString(R.string.msg_add_pc), false); getResources().getString(R.string.msg_add_pc), false);
success = managerBinder.addComputerBlocking(host, true); try {
success = managerBinder.addComputerBlocking(host, true);
} catch (IllegalArgumentException e) {
// This can be thrown from OkHttp if the host fails to canonicalize to a valid name.
// https://github.com/square/okhttp/blob/okhttp_27/okhttp/src/main/java/com/squareup/okhttp/HttpUrl.java#L705
e.printStackTrace();
success = false;
}
if (!success){ if (!success){
wrongSiteLocal = isWrongSubnetSiteLocalAddress(host); wrongSiteLocal = isWrongSubnetSiteLocalAddress(host);
} }