Skip to content

Commit

Permalink
Hotfix: crash caused by malformed blacklist JSON
Browse files Browse the repository at this point in the history
Fixes #146
  • Loading branch information
bitWolfy committed Apr 9, 2020
1 parent 43e064e commit f694e2d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/js/components/data/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ export class User {
this.userid = parseInt($ref.attr("data-user-id")) || 0;
this.level = $ref.attr("data-user-level-string") || "Guest";

const filters = JSON.parse($("head meta[name=blacklisted-tags]").attr("content"));
const filters = $("head meta[name=blacklisted-tags]").attr("content");
const blacklistEnabled = $("#disable-all-blacklists").is(":visible");

for (const filter of filters) {
this.addBlacklistFilter(filter, blacklistEnabled);
if (filters !== undefined) {
for (const filter of JSON.parse(filters)) {
this.addBlacklistFilter(filter, blacklistEnabled);
}
}
}

Expand Down

0 comments on commit f694e2d

Please sign in to comment.