Handle error if Bitmaks.Init returns an error
All errors Bitmask.Init() init returns are non-recoverable. One example is if bitmask-root does not exist:
2024-07-02T14:37:42+02:00 INF Enabling logging hint="you can change the log level with env LOG_LEVEL=INFO|DEBUG|TRACE" logFile=/home/pea/.config/leap/systray.log
2024-07-02T14:37:42+02:00 TRC Initializing bitmask
2024-07-02T14:37:42+02:00 DBG Using specific API backend version apiVersion=3
2024-07-02T14:37:42+02:00 DBG Client expects anon auth
2024-07-02T14:37:42+02:00 INF Checking for updates url=https://downloads.leap.se/RiseupVPN/linux/lastver
2024-07-02T14:37:42+02:00 DBG Remote version version=0.21.10.99
2024-07-02T14:37:42+02:00 DBG Installed version version=unknown
2024-07-02T14:37:42+02:00 INF Sucessfully checked if there is an update updateAvailable=false
2024-07-02T14:37:42+02:00 DBG Fetching MOTD url=https://static.riseup.net/vpn/motd.json
2024-07-02T14:37:43+02:00 DBG There are pending messages pendingMessages=4
2024-07-02T14:37:43+02:00 DBG Sucessfully wrote OpenVPN CA certificate (hardcoded in the binary, not coming from API) caCertPath=/tmp/leap-2127967852/cacert.pem
2024-07-02T14:37:43+02:00 INF Stopping firewall
2024-07-02T14:37:43+02:00 WRN Could not stop firewall error="bitmask-root not found in \"/usr/sbin/bitmask-root, /usr/local/sbin/bitmask-root\""
2024-07-02T14:37:43+02:00 ERR Could not initialize bitmask error="bitmask-root not found in \"/usr/sbin/bitmask-root, /usr/local/sbin/bitmask-root\""
2024-07-02T14:37:43+02:00 INF Fetching gateways...
qml: errors, setting root.error
qml: errors, setting root.error
2024-07-02T14:37:46+02:00 INF Got sorted gateways: [vpn20-par.riseup.net vpn03-par.riseup.net vpn05-par.riseup.net vpn07-par.riseup.net vpn14-par.riseup.net vpn08-par.riseup.net vpn02-par.riseup.net vpn11-par.riseup.net vpn06-ams.riseup.net vpn13-ams.riseup.net vpn19-ams.riseup.net vpn04-ams.riseup.net vpn10-mtl.riseup.net vpn18-mtl.riseup.net vpn12-nyc.riseup.net vpn17-mia.riseup.net vpn09-mia.riseup.net vpn01-sea.riseup.net vpn15-sea.riseup.net vpn16-sea.riseup.net]
2024-07-02T14:37:46+02:00 DBG seems to be initialized...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x88 pc=0x668f3b851bfd]
goroutine 11 [running]:
0xacab.org/leap/bitmask-vpn/pkg/backend.connectionCtx.delayCheckForGateways.func1()
/home/pea/projects/leap/bitmask-vpn/pkg/backend/gatewaychecker.go:24 +0x5d
created by 0xacab.org/leap/bitmask-vpn/pkg/backend.connectionCtx.delayCheckForGateways in goroutine 19
/home/pea/projects/leap/bitmask-vpn/pkg/backend/gatewaychecker.go:10 +0xaf
./run3.sh: line 19: 53048 Aborted (core dumped) build/qt/release/riseup-vpn
Edited by Pea Nut