Consider checking for `null` somewhere for `primarySize` before the division below.