mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 15:26:33 +00:00
fix(code-editor): ensure localStorage access is safe in non-browser environments
This commit is contained in:
parent
8be38cee1d
commit
524cce5a73
@ -197,7 +197,9 @@ export default function CodeEditor() {
|
||||
};
|
||||
|
||||
function handleEditorChange(value: string | undefined) {
|
||||
localStorage.setItem(`code-editor-value-${language}`, value ?? "");
|
||||
if (typeof window !== "undefined") {
|
||||
localStorage.setItem(`code-editor-value-${language}`, value ?? "");
|
||||
}
|
||||
}
|
||||
|
||||
const editorValue =
|
||||
|
Loading…
Reference in New Issue
Block a user