AttributeError when deleting diagrams with elements
### Describe the bug
I am getting the following AttributeError if I delete a diagram with elements on it.

```
Traceback (most recent call last):
  File "/home/dan/Projects/gaphor/.venv/lib/python3.11/site-packages/gaphas/decorators.py", line 86, in async_wrapper
    func(*args, **kwargs)
  File "/home/dan/Projects/gaphor/.venv/lib/python3.11/site-packages/gaphas/view/gtkview.py", line 319, in update
    self.update_bounding_box(dirty_items)
  File "/home/dan/Projects/gaphor/.venv/lib/python3.11/site-packages/gaphas/view/gtkview.py", line 356, in update_bounding_box
    painter.paint_item(item, cr)
  File "/home/dan/Projects/gaphor/gaphor/diagram/painter.py", line 28, in paint_item
    style = diagram.style(StyledItem(item, selection, self.dark_mode))
            ^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'style'
```

### To Reproduce
Steps to reproduce the behavior:
1. Open the Generic Model
2. Open the New diagram
3. Create a class on the diagram
4. Delete the New Diagram

### Expected behavior
No Error.

### Screenshots
If applicable, add screenshots to help explain your problem.

### OS
- [X] Linux
- [ ] macOS
- [ ] Windows

### Version
Version of Gaphor: latest main

### Additional information
Add any other context about the problem here.

diff --git a/gaphor/diagram/painter.py b/gaphor/diagram/painter.py
index 07fa444fb..2ebc259ad 100644
--- a/gaphor/diagram/painter.py
+++ b/gaphor/diagram/painter.py
@@ -24,7 +24,9 @@ class ItemPainter:
 
     def paint_item(self, item, cr):
         selection = self.selection
-        diagram = item.diagram
+        if not (diagram := item.diagram):
+            return
+
         style = diagram.style(StyledItem(item, selection, self.dark_mode))
 
         cr.save()
['gaphor/diagram/painter.py']