Fixed `AttributeError` when `context_data` is `None`