refactor: use null test in circular array code