Protect against possibly NULL pointer being referenced
Merge branch 'pr/4085'