limit list index to valid range
This commit is contained in:
parent
c989b9dae9
commit
040e81014e
|
@ -3707,7 +3707,8 @@ step_file_view(System_Functions *system, View *view, View *active_view, Input_Su
|
||||||
|
|
||||||
if (file_info.name_match){
|
if (file_info.name_match){
|
||||||
id.id[0] = (u64)(file_info.info);
|
id.id[0] = (u64)(file_info.info);
|
||||||
if (gui_do_file_option(target, id, file_info.info->filename, file_info.is_folder, file_info.message)){
|
if (gui_do_file_option(target, id, file_info.info->filename,
|
||||||
|
file_info.is_folder, file_info.message)){
|
||||||
if (file_info.is_folder){
|
if (file_info.is_folder){
|
||||||
set_last_folder(&hdir->string, file_info.info->filename, '/');
|
set_last_folder(&hdir->string, file_info.info->filename, '/');
|
||||||
do_new_directory = 1;
|
do_new_directory = 1;
|
||||||
|
|
|
@ -142,6 +142,7 @@ struct GUI_Target{
|
||||||
GUI_id auto_hot;
|
GUI_id auto_hot;
|
||||||
GUI_id hover;
|
GUI_id hover;
|
||||||
|
|
||||||
|
// TODO(allen): Can we remove original yet?
|
||||||
GUI_Scroll_Vars scroll_original;
|
GUI_Scroll_Vars scroll_original;
|
||||||
GUI_Scroll_Vars scroll_updated;
|
GUI_Scroll_Vars scroll_updated;
|
||||||
|
|
||||||
|
@ -490,7 +491,15 @@ gui_begin_list(GUI_Target *target, GUI_id id, i32 list_i, b32 activate_item, GUI
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result){
|
if (result){
|
||||||
|
if (list_i < 0){
|
||||||
|
gui_fill_item_update(update, target, h, active, 0);
|
||||||
|
}
|
||||||
|
else if (list_i >= target->list_max){
|
||||||
|
gui_fill_item_update(update, target, h, active, target->list_max - 1);
|
||||||
|
}
|
||||||
|
else{
|
||||||
gui_fill_item_update(update, target, h, active);
|
gui_fill_item_update(update, target, h, active);
|
||||||
|
}
|
||||||
target->animating = 1;
|
target->animating = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue