Skip to content

Commit 345c78d

Browse files
author
dlevy47
committed
Fix bad null check
1 parent 0e70983 commit 345c78d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/interface.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ impl Interface {
4949
if let Some(iface) = convert_ifaddrs(cur) {
5050
ret.push(iface);
5151
}
52+
5253
//TODO: do something else maybe?
5354
cur = unsafe { (*cur).ifa_next };
5455
}
@@ -68,7 +69,7 @@ fn convert_ifaddrs (ifa: *mut ffi::ifaddrs) -> Option<Interface> {
6869
Err(_) => return None,
6970
};
7071

71-
let kind = if ifa.ifa_addr == ptr::null_mut() {
72+
let kind = if ifa.ifa_addr != ptr::null_mut() {
7273
match unsafe { *ifa.ifa_addr }.sa_family as i32 {
7374
ffi::AF_PACKET => Kind::Packet,
7475
socket::AF_INET => Kind::Ipv4,

0 commit comments

Comments
 (0)