Fix - setting can be null sometimes (autosave)

This commit is contained in:
cmdr2 2022-11-14 18:10:23 +05:30
parent e252c9ac05
commit ab6ec3a9b7
2 changed files with 4 additions and 1 deletions

View File

@ -276,7 +276,7 @@
<script src="media/js/utils.js?v=5"></script>
<script src="media/js/inpainting-editor.js?v=1"></script>
<script src="media/js/image-modifiers.js?v=3"></script>
<script src="media/js/auto-save.js?v=2.2"></script>
<script src="media/js/auto-save.js?v=2.3"></script>
<script src="media/js/main.js?v=5"></script>
<script src="media/js/themes.js?v=2"></script>
<script>

View File

@ -277,6 +277,9 @@ function tryLoadOldSettings() {
var localStorageValue = localStorage.getItem(localStorageKey);
if (localStorageValue !== null) {
var setting = SETTINGS[individual_settings_map[localStorageKey]]
if (setting == null || setting == undefined) {
return
}
if (setting.element.type == "checkbox" && (typeof localStorageValue === "string" || localStorageValue instanceof String)) {
localStorageValue = localStorageValue == "true"
}