Commit 33f5edd
authored
Fix infinite onerror loop in avatar image loader (#82)
Avatar images have an onerror attribute to set their image to a generic avatar image if they fail to load from discord. However, in situations where the network fails or the discord CDN is unavailable for some reason (adblockers), this will throw an error as well.
In browsers other than chrome, this will trigger the on-error handler again, infinitely looping requests as fast as possible.
We set the onerror handler to null before making the new request to get around this and ensure if the fallback fails to load we don't make further requests.
Signed-off-by: Bast <52266665+bast0006@users.noreply.github.com>1 parent 9e4dff4 commit 33f5edd
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
245 | | - | |
| 245 | + | |
0 commit comments