Skip to content

Commit

Permalink
Fixed invalid array access when no documents are listed
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenldl committed Oct 14, 2024
1 parent ae00fb8 commit 8a70a1d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions bin/multi_file_view.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1010,13 +1010,16 @@ let main : Nottui.ui Lwd.t =
let document_info_s =
Document_store.usable_documents document_store
in
let document_count = Array.length document_info_s in
set_document_selected
~choice_count:(Array.length document_info_s)
~choice_count:document_count
(Lwd.peek Vars.index_of_document_selected);
set_search_result_selected
~choice_count:(Array.length
(snd document_info_s.(Lwd.peek Vars.index_of_document_selected)))
(Lwd.peek Vars.index_of_search_result_selected);
if document_count > 0 then (
set_search_result_selected
~choice_count:(Array.length
(snd document_info_s.(Lwd.peek Vars.index_of_document_selected)))
(Lwd.peek Vars.index_of_search_result_selected)
);
let$* (term_width, term_height) = Lwd.get Ui_base.Vars.term_width_height in
let$* bottom_pane =
Bottom_pane.main
Expand Down

0 comments on commit 8a70a1d

Please sign in to comment.