segmentation fault when backend cannot initialize connection
while investigating #463 (closed) I discovered an easy way to trigger the silent crashes we're seeing with 0.21.2: just point api.black.riseup.net to localhost in /etc/hosts. This uncovers a panic in the backend that is not catched and crashes the gui.
2021/03/11 02:46:37 Client expects anon auth
2021/03/11 02:46:37 Fetching certificate to /tmp/leap-892098372/openvpn.pem
2021/03/11 02:46:37 Error starting VPN: Post "https://api.black.riseup.net/3/cert": dial tcp 127.0.0.1:443: connect: connection refused
2021/03/11 02:46:37 error: cannot initialize bitmask
qml: ERRORS: Post "https://api.black.riseup.net/3/cert": dial tcp 127.0.0.1:443: connect: connection refused
qml: ERRORS: Post "https://api.black.riseup.net/3/cert": dial tcp 127.0.0.1:443: connect: connection refused
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x60 pc=0x5579c860d4f8]
goroutine 16 [running]:
0xacab.org/leap/bitmask-vpn/pkg/backend.startVPN()
/home/kali/leap/bitmask-vpn/pkg/backend/actions.go:9 +0x38
created by 0xacab.org/leap/bitmask-vpn/pkg/backend.SwitchOn
/home/kali/leap/bitmask-vpn/pkg/backend/api.go:43 +0x5d
zsh: abort (core dumped) ./build/qt/release/riseup-vpn
╭─ ~/leap/bitmask-vpn bug/fail-gracefully *13 !2 ?15
Edited by Kali Kaneko