Refs #13988; fixed an issue where backward and forward relations crashed when relation was None and we were checking for relation.portal_type before checking for the relation