From c43d843b7a1fa2cb1eb57b82d7a31c1dac352fa2 Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Mon, 4 Apr 2016 13:01:33 +0000
Subject: [PATCH] Task #8887: check for null

---
 .../ResourceAssignmentDatabase/radbpglistener.py              | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbpglistener.py b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbpglistener.py
index 13e20e454f7..dae26aeefc5 100644
--- a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbpglistener.py
+++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radbpglistener.py
@@ -104,7 +104,7 @@ class RADBPGListener(PostgresListener):
                 if state in contentDict:
                     for field in fields:
                         try:
-                            if field in contentDict[state]:
+                            if contentDict[state] and field in contentDict[state]:
                                 timestampStr = contentDict[state][field]
                                 if timestampStr.rfind('.') > -1:
                                     timestamp = datetime.strptime(timestampStr, '%Y-%m-%d %H:%M:%S.%f')
@@ -124,7 +124,7 @@ class RADBPGListener(PostgresListener):
         try:
             content = json.loads(payload)
 
-            if 'new' in content and 'old' in content:
+            if 'new' in content and content['new'] and 'old' in content and content['old']:
                 # check if new and old are equal.
                 # however, new and old can be based on different views,
                 # so, only check the values for the keys they have in common
-- 
GitLab