From 7cb407f0a7b9299565bba4966bd82509cafb51a0 Mon Sep 17 00:00:00 2001 From: Stephen Date: Fri, 5 Sep 2025 22:13:46 -0400 Subject: [PATCH] if a corrupted gamepad comment is found, remove it and create a new comment --- addons/gamepad/userscript.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/gamepad/userscript.js b/addons/gamepad/userscript.js index ba1c59be56..e94b3d38db 100644 --- a/addons/gamepad/userscript.js +++ b/addons/gamepad/userscript.js @@ -196,7 +196,7 @@ export default async function ({ addon, console, msg }) { console.warn("Could not export gamepad settings"); return; } - const existingComment = findOptionsComment(); + let existingComment = findOptionsComment(); if (existingComment) { const parsedExistingSettingsMap = parseOptionsComment(existingComment); if (parsedExistingSettingsMap) { @@ -205,6 +205,8 @@ export default async function ({ addon, console, msg }) { const mergedMap = new Map([...parsedExistingSettingsMap, ...exportedSettingsMap]); existingComment.text = formatMapAsComment(mergedMap); } else { + // In case of corrupted settings, remove the bad comment (a new one will be created below) + removeStoredMappings(); existingComment = null; } }