qdm12 / gluetun

VPN client in a thin Docker container for multiple VPN providers, written in Go, and using OpenVPN or Wireguard, DNS over TLS, with a few proxy servers built-in.
https://hub.docker.com/r/qmcgaw/gluetun
MIT License
7.45k stars 350 forks source link

fix: crash in custom wireguard connection with no server names #2249

Closed junr03 closed 4 months ago

junr03 commented 4 months ago

Currently accessing selection.Names[0] can cause an index out of bounds panic if the user did not set any server names in their config.

This change deletes the line that would cause the crash, while leaving the existing conditional set in the line below.

qdm12 commented 4 months ago

Hi @junr03 thank you for this wonderful PR! 💯 Unfortunately I jumped into fixing and pushing a fix on my side without having a look at the pull requests section, my apologies. Next time feel free to write you opened a PR for it in the issue (for example https://github.com/qdm12/gluetun/issues/2244 here), so I spot it and merge it, I'm always happy to get small and/or first-time contributors involved 😉 Thanks again 🎖️

junr03 commented 4 months ago

No worries! And funny enough I did the same but in reverse. I posted the PR without checking in the open issues first :)

I used to be a full time OSS contributor, but a few years out have made my etiquette rusty!

Thanks for landing a fix either way.