Added a check on a null pointer. Re #6533.