add some null checks
@@ -261,7 +261,7 @@ class Parser:
for rule in rules:
matches = 0
for r in rules[rule]:
- if r['rule']['device_key'] == 'os':
+ if r['rule'] and r['rule']['device_key'] == 'os':
match = False
if 'ipv4_addresses' in endpoint.metadata:
for ip in endpoint.metadata['ipv4_addresses']:
@@ -277,7 +277,7 @@ class Parser:
match = True
if match:
matches += 1
- elif r['rule']['device_key'] == 'role':
+ elif r['rule'] and r['rule']['device_key'] == 'role':
match = False
if 'mac_addresses' in endpoint.metadata:
for mac in endpoint.metadata['mac_addresses']:
@@ -301,7 +301,7 @@ class Parser:
match = True
if match:
matches += 1
- elif r['rule']['device_key'] == 'behavior':
+ elif r['rule'] and r['rule']['device_key'] == 'behavior':
match = False
if 'mac_addresses' in endpoint.metadata:
for mac in endpoint.metadata['mac_addresses']:
