Android Bridge: Never send a response twice

Sometimes after responding with an error we would not stop, and also
return with a sucess after.
This commit is contained in:
Vishesh Handa
2019-06-02 15:23:01 +02:00
parent b5f5fdcd67
commit 8b8bcc70a3

View File

@ -199,6 +199,7 @@ public class MainActivity extends FlutterActivity implements MethodCallHandler {
} catch (IOException ex) {
Log.d("getSSHPublicKey", ex.toString());
result.error("FAILED", "Failed to read the public key", null);
return;
}
result.success(publicKey);
@ -223,6 +224,7 @@ public class MainActivity extends FlutterActivity implements MethodCallHandler {
} catch (IOException ex) {
Log.d("setSshKeys", ex.toString());
result.error("FAILED", "Failed to write the ssh keys", null);
return;
}
result.success(publicKey);
@ -235,9 +237,11 @@ public class MainActivity extends FlutterActivity implements MethodCallHandler {
} catch (Exception e) {
e.printStackTrace();
result.error("FAILED", e.toString(), null);
return;
}
result.success(filePath);
return;
}
result.notImplemented();