Except IndexError for MTex.get_part_by_tex

This commit is contained in:
YishiMichael 2022-03-21 22:45:06 +08:00
parent 2a0709664d
commit c51811d2f1
No known key found for this signature in database
GPG key ID: EC615C0C5A86BC80

View file

@ -557,7 +557,10 @@ class MTex(_TexSVG):
def get_part_by_tex(self, tex, index=0):
all_parts = self.get_parts_by_tex(tex)
return all_parts[index]
try:
return all_parts[index]
except IndexError:
return None
def set_color_by_tex(self, tex, color):
self.get_parts_by_tex(tex).set_color(color)