Replaced unnecessary use of eval() in usermode icon function.
Don't think this was possible to abuse, but it's probably better to avoid eval anyway since it's a potential security risk.
This commit is contained in:
parent
5cbf2eb917
commit
8d1bef4db2
1 changed files with 11 additions and 7 deletions
18
memos.py
18
memos.py
|
@ -1510,13 +1510,17 @@ class PesterMemo(PesterConvo):
|
||||||
|
|
||||||
def iconCrap(self, c, down=True):
|
def iconCrap(self, c, down=True):
|
||||||
for m in self.umodes if down else reversed(self.umodes):
|
for m in self.umodes if down else reversed(self.umodes):
|
||||||
if eval("c." + m):
|
# These if attr used to be an if eval("c." + m),
|
||||||
if m == "box":
|
# better not to use eval() unnecessarily for security reasons though.
|
||||||
icon = PesterIcon("smilies/box.png")
|
# Hopefully this works fine too.
|
||||||
else:
|
if hasattr(c, str(m)):
|
||||||
icon = PesterIcon(self.mainwindow.theme["memos/" + m + "/icon"])
|
if getattr(c, str(m)):
|
||||||
c.setIcon(icon)
|
if m == "box":
|
||||||
return
|
icon = PesterIcon("smilies/box.png")
|
||||||
|
else:
|
||||||
|
icon = PesterIcon(self.mainwindow.theme[f"memos/{m}/icon"])
|
||||||
|
c.setIcon(icon)
|
||||||
|
return
|
||||||
icon = QtGui.QIcon()
|
icon = QtGui.QIcon()
|
||||||
c.setIcon(icon)
|
c.setIcon(icon)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue