Fix NPE for http://jira.diamond.ac.uk/browse/SCI-1505