BZ-1095980: preventing NPE at runtime
(cherry picked from commit 96c299cf2e7d360fa355a762d1ff28db7ba16eed)