openvpn_flutter
openvpn_flutter copied to clipboard
Await Future in method "disconnect"
The invokeMethod("disconnect") call is not awaited. Which seems to throw if no connection is running and the method gets called. This Exception can't be catched because disconnect() does not await the invokeMethod() call.
///Disconnect from VPN
void disconnect() {
_tempDateTime = null;
_channelControl.invokeMethod("disconnect");
if (_vpnStatusTimer?.isActive ?? false) {
_vpnStatusTimer?.cancel();
_vpnStatusTimer = null;
}
}
I'm getting sometime:
E/flutter ( 5968): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(error, Attempt to invoke virtual method 'void de.blinkt.openvpn.core.OpenVPNService.openvpnStopped()' on a null object reference, null, java.lang.NullPointerException: Attempt to invoke virtual method 'void de.blinkt.openvpn.core.OpenVPNService.openvpnStopped()' on a null object reference