aboutsummaryrefslogtreecommitdiff
path: root/game/src/OptionMenu/ScreenModeSelector.gd
diff options
context:
space:
mode:
Diffstat (limited to 'game/src/OptionMenu/ScreenModeSelector.gd')
-rw-r--r--game/src/OptionMenu/ScreenModeSelector.gd12
1 files changed, 8 insertions, 4 deletions
diff --git a/game/src/OptionMenu/ScreenModeSelector.gd b/game/src/OptionMenu/ScreenModeSelector.gd
index 92c5d60..b4fc5ab 100644
--- a/game/src/OptionMenu/ScreenModeSelector.gd
+++ b/game/src/OptionMenu/ScreenModeSelector.gd
@@ -29,7 +29,11 @@ func _setup_button():
selected = default_selected
func _on_item_selected(index : int):
- var window := get_viewport().get_window()
- var current_resolution := Resolution.get_current_resolution()
- window.mode = get_window_mode_from_screen_mode(index)
- Resolution.set_resolution(current_resolution)
+ if _valid_index(index):
+ var window := get_viewport().get_window()
+ var current_resolution := Resolution.get_current_resolution()
+ window.mode = get_window_mode_from_screen_mode(index)
+ Resolution.set_resolution(current_resolution)
+ else:
+ push_error("Invalid ScreenModeSelector index: %d" % index)
+ reset_setting()