diff options
author | Hop311 <Hop3114@gmail.com> | 2023-02-26 17:12:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-26 17:12:07 +0100 |
commit | 93c6b207c11fdaba484410eb53fc11b35fbbb3bd (patch) | |
tree | 911753c663adb3955ab15cc8b5ac37498c2fda6e /game/src/OptionMenu/ScreenModeSelector.gd | |
parent | a37c5085c3b7ee515789d681c8c18d71071fb771 (diff) |
Add Setting Sanatization (#21)
Diffstat (limited to 'game/src/OptionMenu/ScreenModeSelector.gd')
-rw-r--r-- | game/src/OptionMenu/ScreenModeSelector.gd | 12 |
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() |