NSXv: validate that router is not None

Check that the value returned is not None and then check the
type

Change-Id: Ib95f18d329de8c46ce5a5547b7b4dab459d3f419
Fixes-Bug: #1500037
This commit is contained in:
Gary Kotton 2015-08-16 18:59:07 -07:00 committed by Kobi Samoray
parent b9a69d335a
commit fe5acd6213

@ -241,7 +241,7 @@ class RouterSharedDriver(router_driver.RouterBaseDriver):
nsx_attr = (context.session.query(
nsxv_models.NsxvRouterExtAttributes).filter_by(
router_id=r['id']).first())
if nsx_attr['router_type'] == 'shared':
if nsx_attr and nsx_attr['router_type'] == 'shared':
shared_routers.append(r)
return shared_routers