CID-1241966 Fix potential null deref
CID-1241965 Fix potential NPE
Merge branch 'bugfix/CID-1241966'