Skip to content

Commit

Permalink
prevent input path recursion and edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
moritztim committed Nov 16, 2023
1 parent 0534877 commit 438acfb
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions addons/form/nodes/FormLabel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ class_name FormLabel extends Label
"GraphEdit"
) var input_path: NodePath:
set(new_val):
input_path = new_val
input = get_node(input_path)
_input_path = new_val
if is_inside_tree():
input = get_node_or_null(_input_path)
get:
if input != null:
if _input_path not in [null, ""] && input != null:
return input.get_path() # mainly for when u switched from a previous version that exported input.
return input_path #TODO can't return null here, maybe there's another way. This is fine tho, I can't imagine a situation where input is null but input_path is not.
return _input_path #TODO can't return null here, maybe there's another way. This is fine tho, I can't imagine a situation where input is null but input_path is not.

## Internal storage for input_path
var _input_path: NodePath

## Input control to label
var input: Control:
Expand Down

0 comments on commit 438acfb

Please # to comment.