diff --git a/CHANGELOG.md b/CHANGELOG.md index d943fac..edd8f00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## 0.0.5 +- fix: ignore corrupt workspace-state + - when we load the sub-workspace vscode forcefully reloads the extension. To avoid any inconvenience e.g. because calling "decompile" appears to have no action we replay that command once we're reloaded. that command is stored in the workspace for 30secs (file to be decompiled on reload). + - in case the workspace state is corrupt the extension would permanently throw. this changeset is adding safeguards to avoid that the extension cannot be used anymore because of a corrupt workspace state. + ## 0.0.4 - new: multi-select decompilation - select multiple items and click `decompile` to decompile them in parallel diff --git a/package.json b/package.json index 39c24a4..fb6ee78 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "vscode-decompiler", "displayName": "Decompiler", "description": "Decompile the $h*! out of things", - "version": "0.0.4", + "version": "0.0.5", "keywords": [ "security", "decompile", diff --git a/src/extension.js b/src/extension.js index 7cff07b..6c52962 100644 --- a/src/extension.js +++ b/src/extension.js @@ -80,15 +80,20 @@ function onActivate(context) { }) ); - const pendingUrisMemento = JSON.parse(context.workspaceState.get("vscodeDecompiler.pendingUri", "{}")); - if(pendingUrisMemento && pendingUrisMemento.ts && pendingUrisMemento.items.length){ - context.workspaceState.update("vscodeDecompiler.pendingUri", "{}").then(() => { - if(Date.now() - pendingUrisMemento.ts <= 30 * 1000){ - // 30sec grace period. ignore all other pendingUris - console.log("restarting decompile for: " + pendingUrisMemento.items); - vscode.commands.executeCommand("vscode-decompiler.decompile", undefined ,pendingUrisMemento.items.map(u => new vscode.Uri(u))); - } - }); + try { + // let's make sure we do not bail if the workspacestate is corrupt. Just ignore it in this case. + const pendingUrisMemento = JSON.parse(context.workspaceState.get("vscodeDecompiler.pendingUri", "{}") || "{}"); + if(pendingUrisMemento && pendingUrisMemento.ts && pendingUrisMemento.items.length){ + context.workspaceState.update("vscodeDecompiler.pendingUri", "{}").then(() => { + if(Date.now() - pendingUrisMemento.ts <= 30 * 1000){ + // 30sec grace period. ignore all other pendingUris + console.log("restarting decompile for: " + pendingUrisMemento.items); + vscode.commands.executeCommand("vscode-decompiler.decompile", undefined ,pendingUrisMemento.items.map(u => new vscode.Uri(u))); + } + }); + } + } catch(err) { + console.warn(err); } }