Skip to content

Commit be9483a

Browse files
authored
friends list fix for rotur.js
1 parent a2710b7 commit be9483a

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

featured/Rotur.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -838,19 +838,29 @@ class RoturExtension {
838838

839839
myFriends() {
840840
if (!(this.authenticated && this.is_connected)) return ["Not Authenticated"];
841-
let keys = [];
842-
for (let key of this.user["sys.friends"]) {
843-
keys.push(key);
841+
let keys = this.user["sys.friends"];
842+
if (typeof keys === "string") {
843+
try {
844+
keys = JSON.parse(keys);
845+
} catch (e) {
846+
console.error("Failed to parse friends list:", e);
847+
return ["Invalid Friends List"];
848+
}
844849
}
845850
if (keys.length === 0) return ["No Friends"];
846851
else return keys;
847852
}
848853

849854
myRequests() {
850855
if (!(this.authenticated && this.is_connected)) return ["Not Authenticated"];
851-
let keys = [];
852-
for (let key of this.user["sys.requests"]) {
853-
keys.push(key);
856+
let keys = this.user["sys.requests"];
857+
if (typeof keys === "string") {
858+
try {
859+
keys = JSON.parse(keys);
860+
} catch (e) {
861+
console.error("Failed to parse requests list:", e);
862+
return ["Invalid Requests List"];
863+
}
854864
}
855865
if (keys.length === 0) return ["No Requests"];
856866
else return keys;

0 commit comments

Comments
 (0)