FILEUPLOAD-256 Added null pointer handling

Added null pointer handling to stop NPEs being thrown.