Fix for a null reference exception (caused by what appears to be an Umbraco bug).