copy dict keys before iterating

python doesn't like changing dicts while iterating over that dict
This commit is contained in:
jomo
2015-03-15 05:00:04 +01:00
parent 1db0ac4cd5
commit 4357c46085

View File

@@ -47,7 +47,7 @@ def on_quit(event):
uuid = uid(event.getPlayer())
if uuid in toggle_dict:
del toggle_dict[uuid]
for pid in toggle_dict:
for pid in list(toggle_dict):
if toggle_dict[pid] == uuid:
del toggle_dict[pid]
msg(Bukkit.getPlayer(juuid(pid)), "%s &cwent off so your Private Message Toggle has been disabled!" % Bukkit.getPlayer(juuid(uuid)).getDisplayName())