gateway: update logic of gw_default_delete_handler
authorFerry Huberts <ferry.huberts@pelagic.nl>
Fri, 27 Jul 2012 10:24:56 +0000 (12:24 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 1 Aug 2012 09:38:41 +0000 (11:38 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/gateway_default_handler.c

index ec6225c..132f203 100644 (file)
@@ -238,10 +238,10 @@ static void gw_default_update_handler(struct gateway_entry *gw) {
  * @param gw the gateway entry
  */
 static void gw_default_delete_handler(struct gateway_entry *gw) {
-  bool isv4 = (gw == olsr_get_ipv4_inet_gateway(NULL));
-  bool isv6 = (gw == olsr_get_ipv6_inet_gateway(NULL));
+  bool isv4 = gw && (gw == olsr_get_ipv4_inet_gateway(NULL));
+  bool isv6 = gw && (gw == olsr_get_ipv6_inet_gateway(NULL));
 
-  if (gw && (isv4 || isv6)) {
+  if (isv4 || isv6) {
     olsr_gw_default_lookup_gateway(isv4, isv6);
   }
 }