Maybe the null check should be inside ``createStyleRange``, so that it is used by all callers.