Skip to content

Commit

Permalink
fix: Prevent error on searching component if there is no component (#…
Browse files Browse the repository at this point in the history
…1167)

fix PARTSEG-VD

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved error handling in the image loading process to prevent
crashes when encountering empty data.
  
This change enhances the application's stability and user experience by
ensuring smoother operation under edge cases.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
Czaki authored Jul 23, 2024
1 parent 2366990 commit d87bd21
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion package/PartSeg/common_gui/napari_image_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,12 @@ def event(self, event: QEvent):
return super().event(event)

def _search_component(self):
max_components = max(max(image_info.roi_info.bound_info) for image_info in self.image_info.values())
try:
max_components = max(max(image_info.roi_info.bound_info) for image_info in self.image_info.values())
except ValueError as e:
if "empty" in e.args[0]:
return
raise e
if self.viewer.dims.ndisplay == 3:
self._search_type = SearchType.Highlight

Expand Down

0 comments on commit d87bd21

Please sign in to comment.