Skip to content

Fix: Surface Colour/Transparency KeyError Crash - #1377

Open
Halcyonic-01 wants to merge 1 commit into
invesalius:masterfrom
Halcyonic-01:fix/surface-colour-keyerror
Open

Fix: Surface Colour/Transparency KeyError Crash#1377
Halcyonic-01 wants to merge 1 commit into
invesalius:masterfrom
Halcyonic-01:fix/surface-colour-keyerror

Conversation

@Halcyonic-01

Copy link
Copy Markdown
Contributor

Fixes #1375
Added early-return guards in both SetActorTransparency() and SetActorColour() to skip the operation when surface_index is not present in actors_dict.

  def SetActorTransparency(self, surface_index, transparency):
+     if surface_index not in self.actors_dict:
+         return
      self.actors_dict[surface_index].GetProperty().SetOpacity(1 - transparency)

  def SetActorColour(self, surface_index, colour):
+     if surface_index not in self.actors_dict:
+         return
      self.actors_dict[surface_index].GetProperty().SetColor(colour[:3])

@Halcyonic-01

Halcyonic-01 commented Apr 28, 2026

Copy link
Copy Markdown
Contributor Author

Hi @paulojamorim sir,
Just a gentle reminder regarding this PR. I’d really appreciate your feedback whenever you get time.
Thanks a lot!

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.

Fix: Surface Colour/Transparency KeyError Crash

1 participant