Skip to content

Commit

Permalink
Fix issue with empty notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
joouha committed Apr 11, 2024
1 parent 23cd5a6 commit d3e2e2a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Upcoming
Fixed
=====

- Fix rare bug causing exception when notebook has no cells
- Prevent race condition causing duplicate cells at startup
- Mark notebook as modified when changing cell type
- Prevent ruff formatter deleting buffer contents
Expand Down
6 changes: 3 additions & 3 deletions euporie/notebook/tabs/notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ def load_container(self) -> AnyContainer:
@property
def cell(self) -> Cell:
"""Return the currently selected `Cell` in this `Notebook`."""
cell = self.page.get_child().content
assert isinstance(cell, Cell)
return cell
if isinstance(cell := self.page.get_child().content, Cell):
return cell
return Cell(0, {}, self)

# Editing specific stuff

Expand Down

0 comments on commit d3e2e2a

Please sign in to comment.