mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
fix: sigsev
This commit is contained in:
parent
e5573c20e6
commit
1665003d23
@ -269,8 +269,8 @@ void waybar::modules::Network::getInterfaceAddress() {
|
|||||||
int success = getifaddrs(&ifaddr);
|
int success = getifaddrs(&ifaddr);
|
||||||
if (success == 0) {
|
if (success == 0) {
|
||||||
ifa = ifaddr;
|
ifa = ifaddr;
|
||||||
while (ifa != NULL && ipaddr_.empty() && netmask_.empty()) {
|
while (ifa != nullptr && ipaddr_.empty() && netmask_.empty()) {
|
||||||
if (ifa->ifa_addr->sa_family == family_) {
|
if (ifa->ifa_addr != nullptr && ifa->ifa_addr->sa_family == family_) {
|
||||||
if (strcmp(ifa->ifa_name, ifname_.c_str()) == 0) {
|
if (strcmp(ifa->ifa_name, ifname_.c_str()) == 0) {
|
||||||
ipaddr_ = inet_ntoa(((struct sockaddr_in*)ifa->ifa_addr)->sin_addr);
|
ipaddr_ = inet_ntoa(((struct sockaddr_in*)ifa->ifa_addr)->sin_addr);
|
||||||
netmask_ = inet_ntoa(((struct sockaddr_in*)ifa->ifa_netmask)->sin_addr);
|
netmask_ = inet_ntoa(((struct sockaddr_in*)ifa->ifa_netmask)->sin_addr);
|
||||||
|
Loading…
Reference in New Issue
Block a user