| 893 | * @param {boolean} [loadIfNotSelected=false] - Indicates whether to load the file even if it's not currently selected | 893 | * @param {boolean} [loadIfNotSelected=false] - Indicates whether to load the file even if it's not currently selected |
| 894 | */ | 894 | */ |
| 895 | function reloadEditor(file, loadIfNotSelected = false) { | 895 | function reloadEditor(file, loadIfNotSelected = false) { |
| 896 | const currentIndex = $('#world_editor_select').val(); | 896 | const currentIndex = Number($('#world_editor_select').val()); |
| 897 | const selectedIndex = world_names.indexOf(file); | 897 | const selectedIndex = world_names.indexOf(file); |
| 898 | if (selectedIndex !== -1 && (loadIfNotSelected || currentIndex === selectedIndex)) { | 898 | if (selectedIndex !== -1 && (loadIfNotSelected || currentIndex === selectedIndex)) { |
| 899 | $('#world_editor_select').val(selectedIndex).trigger('change'); | 899 | $('#world_editor_select').val(selectedIndex).trigger('change'); |