mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
fix crashes in add node menu with empty search results (#58)
fixes #54 Reviewed-on: https://codeberg.org/StreamGraph/StreamGraph/pulls/58 Co-authored-by: Lera Elvoé <yagich@poto.cafe> Co-committed-by: Lera Elvoé <yagich@poto.cafe>
This commit is contained in:
parent
fbcb04651c
commit
51046034e4
1 changed files with 9 additions and 0 deletions
|
@ -86,6 +86,9 @@ func search(text: String) -> void:
|
||||||
## Callback for [member search_line_edit]'s input events. Handles highlighting items when navigating with up/down arrow keys.
|
## Callback for [member search_line_edit]'s input events. Handles highlighting items when navigating with up/down arrow keys.
|
||||||
func _on_search_line_edit_gui_input(event: InputEvent) -> void:
|
func _on_search_line_edit_gui_input(event: InputEvent) -> void:
|
||||||
if event.is_action_pressed("ui_down"):
|
if event.is_action_pressed("ui_down"):
|
||||||
|
if scroll_content_container.get_child_count() == 0:
|
||||||
|
return
|
||||||
|
|
||||||
search_line_edit.accept_event()
|
search_line_edit.accept_event()
|
||||||
var category: Category
|
var category: Category
|
||||||
for i: String in categories:
|
for i: String in categories:
|
||||||
|
@ -107,6 +110,9 @@ func _on_search_line_edit_gui_input(event: InputEvent) -> void:
|
||||||
scroll_container.ensure_control_visible(category.get_child(item + 1))
|
scroll_container.ensure_control_visible(category.get_child(item + 1))
|
||||||
|
|
||||||
if event.is_action_pressed("ui_up"):
|
if event.is_action_pressed("ui_up"):
|
||||||
|
if scroll_content_container.get_child_count() == 0:
|
||||||
|
return
|
||||||
|
|
||||||
search_line_edit.accept_event()
|
search_line_edit.accept_event()
|
||||||
var category: Category
|
var category: Category
|
||||||
for i: String in categories:
|
for i: String in categories:
|
||||||
|
@ -160,6 +166,9 @@ func get_previous_visible_category(at: int) -> Category:
|
||||||
|
|
||||||
## Callback for [member search_line_edit]. Handles emitting [signal node_selected]
|
## Callback for [member search_line_edit]. Handles emitting [signal node_selected]
|
||||||
func _on_search_line_edit_text_submitted(_new_text: String) -> void:
|
func _on_search_line_edit_text_submitted(_new_text: String) -> void:
|
||||||
|
if scroll_content_container.get_child_count() == 0:
|
||||||
|
return
|
||||||
|
|
||||||
var category: Category
|
var category: Category
|
||||||
for i: String in categories:
|
for i: String in categories:
|
||||||
var c: Category = categories[i]
|
var c: Category = categories[i]
|
||||||
|
|
Loading…
Reference in a new issue