Skip to content

Fix crash when boxing a table from the line above - #180

Merged
krperry merged 1 commit into
mainfrom
fix/box-table-crash
Oct 19, 2026
Merged

krperry merged 1 commit into
mainfrom
fix/box-table-crash

Conversation

@krperry

@krperry krperry commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

Problem

With the cursor on the line above a table and nothing selected, choosing
Styles > Miscellaneous > Boxes > Box crashes BrailleBlaster:

FormatterException: An error occurred while reformatting
Caused by: NullPointerException: No brl found
  at TextRenderer.appendToView(TextRenderer.kt:119)
  at TextRenderer.addTable(TextRenderer.kt:128)

Cause

TableSelectionModule only marks a table as selected when there is a
range selection, so with just a cursor updateStyle skips the branch that
resolves the original table and detaches its formatted copy.
StylesMenuModule.boxBlock then wraps only the table copy (or one of its
cells), leaving the original table outside the box. On reformat, the
stale copy has no brl and the text renderer throws.

Fix

boxBlock now resolves the node to its owning original table and
detaches the table copy before wrapping, matching the selection-based
path. This also applies to Color Box. With the cursor inside a table cell
and nothing selected, Box now wraps the whole table instead of that cell.

Testing

  • brailleblaster-core compiles.
  • Not yet verified in the running app. The SWTBot UI tests do not start
    on the Windows dev machine, and the existing Box UI tests are disabled.
  • Manual check: open a document with a simple table, put the cursor on
    the line above it, and apply Styles > Miscellaneous > Boxes > Box. The
    box should surround the whole table without a crash.

With the cursor on the line above a table and no selection, the
table-selection path that removes the formatted table copy was skipped.
boxBlock then wrapped only the table copy (or one of its cells), leaving
the original table outside the box and a stale copy without brl in the
document, which crashed the text renderer with "No brl found".

boxBlock now resolves the node to its owning original table and detaches
the table copy before wrapping, matching the selection-based path.
@krperry
krperry merged commit 99e743b into main Oct 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant