mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-11 05:57:07 +03:00
Prevent all strings from being parsed as JSON.
This commit is contained in:
@@ -84,7 +84,6 @@ class SBMap<T, U> extends Map {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var Config: SBObject = {
|
var Config: SBObject = {
|
||||||
/**
|
/**
|
||||||
* Callback function when an option is updated
|
* Callback function when an option is updated
|
||||||
@@ -151,10 +150,14 @@ function decodeStoredItem(id: string, data) {
|
|||||||
|
|
||||||
// This is the old format for SBMap (a JSON string)
|
// This is the old format for SBMap (a JSON string)
|
||||||
if (typeof data === "string") {
|
if (typeof data === "string") {
|
||||||
|
try {
|
||||||
let str = JSON.parse(data);
|
let str = JSON.parse(data);
|
||||||
|
|
||||||
if (Array.isArray(data)) {
|
if (Array.isArray(data)) {
|
||||||
return new SBMap(id, str)
|
return new SBMap(id, str);
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
// Continue normally (out of this if statement)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user