diff
13 	rt = ip_route_output_flow(net, &fl4, NULL);
14 	if (IS_ERR(rt))
15 		goto out;
-	if (rt->rt_uses_gateway && rt->rt_gw_family != AF_INET)
+	if (!IS_ERR(rt) && rt->rt_uses_gateway && rt->rt_gw_family != AF_INET)
16 		goto out;
