Skip to content

Fix: Panel2D crashes when used without borders (#1155)#1156

Open
JigyasuRajput wants to merge 1 commit intofury-gl:v2from
JigyasuRajput:fix/panel2d-no-border-1155
Open

Fix: Panel2D crashes when used without borders (#1155)#1156
JigyasuRajput wants to merge 1 commit intofury-gl:v2from
JigyasuRajput:fix/panel2d-no-border-1155

Conversation

@JigyasuRajput
Copy link

@JigyasuRajput JigyasuRajput commented Mar 8, 2026

Fixes #1155

This pull request improves the robustness of the Panel2D UI container when borders are disabled (has_border=False). Several methods now safely handle the absence of borders, preventing potential errors and ensuring consistent behavior. Additionally, a new test verifies that Panel2D functions correctly without borders.

Robustness improvements for borderless Panel2D:

  • Guard clauses were added to methods such as _get_actors, _update_actors_position, update_border_coords, border_color, and border_width to ensure they handle the case where has_border is False, returning empty lists or exiting early as appropriate. [1] [2] [3] [4] [5] [6] [7]

Testing improvements:

  • Added test_panel2d_no_border_actors_and_scene to verify that Panel2D can be used without borders, including adding actors, updating positions, adding to a scene, and accessing border properties without errors.Guard all self.borders references with self.has_border checks in _get_actors, _update_actors_position, update_border_coords, border_color, and border_width properties.

Guard all self.borders references with self.has_border checks in
_get_actors, _update_actors_position, update_border_coords,
border_color, and border_width properties.
actors = []

actors.extend(self.background.actors)
for border in self.borders.values():

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.borders.value = borders.value

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.

Panel2D Does not work without borders

2 participants