Mitigates a fatal `ArgumentError` when type is nil

**Error Description:**

`comparison of String with nil failed (ArgumentError)`

**Patch Description:**

- before `types` array is `sort`ed, checks that each type is non-`nil`