Skip to content

fix: inspector zoom CCE on empty GeometryTree - #48

Merged
grootstebozewolf merged 1 commit into
feature/sfa-curve-rgrfrom
cursor/inspector-zoom-cce-b5d3
Aug 16, 2026
Merged

fix: inspector zoom CCE on empty GeometryTree#48
grootstebozewolf merged 1 commit into
feature/sfa-curve-rgrfrom
cursor/inspector-zoom-cce-b5d3

Conversation

@grootstebozewolf

Copy link
Copy Markdown
Owner

Fixes #3 (FCP-S). Draft only — do not merge.

Problem

Inspector zoom on an empty geometry tree throws:

ClassCastException: javax.swing.tree.DefaultMutableTreeNode cannot be cast to GeometricObjectNode
  at GeometryTreePanel.getGeometryFromNode
  at GeometryTreePanel.getSelectedGeometry
  at InspectorPanel.actionZoom

The empty-state model is a plain DefaultMutableTreeNode("No geometry shown"). The cell renderer already guards instanceof GeometricObjectNode; zoom and next-node did not.

nextPath also raw-casts the last path component and parent, and NPEs when the selected node is the root (parentPath == null).

Change

Touch only GeometryTreePanel plus a focused unit test.

  • getGeometryFromNode: return null unless value instanceof GeometricObjectNode.
  • nextPath: if the last component or parent is not a GeometricObjectNode, or parentPath is null, return the current path (no-op).

Test

GeometryTreePanelEmptyTest constructs the empty panel, selects the default root, and asserts:

  • getSelectedGeometry() is null (no CCE)
  • moveToNextNode stays on that path (no NPE)

No inspector redesign. No new TestBuilder. No Bar 2 / #38 / #27 / #47. No public noder. No new rung.

Open in Web Open in Cursor 

Empty-state DefaultMutableTreeNode is not a GeometricObjectNode.
Return null from getGeometryFromNode and no-op nextPath instead of
ClassCastException / NPE (issue #3).

Co-authored-by: Jeroen Bloemscheer <grootstebozewolf@users.noreply.github.com>
@grootstebozewolf
grootstebozewolf marked this pull request as ready for review August 16, 2026 18:47
@grootstebozewolf
grootstebozewolf merged commit 3ec573e into feature/sfa-curve-rgr Aug 16, 2026
4 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.

2 participants