batman-adv: avoid NULL dereferences and fix if check