Skip to content

Commit 0769dcd

Browse files
authored
Avoid crashing when URL data has unknown WASM version (#13)
1 parent 007122f commit 0769dcd

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

web/src/components/playground.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,10 @@ export class Playground extends LitElement {
103103

104104
_initState() {
105105
let urlStateData = this._loadURLBase64DataHash();
106-
let version =
107-
urlStateData?.version ??
108-
(this._versions &&
109-
this._versions.length > 0 &&
110-
this._versions[0]?.version);
106+
let version = urlStateData?.version
107+
if (!version || !this._versions?.some(it => it.version === version)) {
108+
version = this._versions?.[0]?.version;
109+
}
111110

112111
if (urlStateData) {
113112
this.state = {

0 commit comments

Comments
 (0)