BHV-698: Guard against null/undefined and non-strings.