Add NULL check to load_balance_by_weight()