* added nullchecks to prevent NPE fixes #2171 * Add test from #2171 and changelog Co-authored-by: jamesagnew <jamesagnew@gmail.com>