Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deal with case when inputs contains empty lists #4664

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/nodes/list_masks/mask_join.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ In the N-Panel (and on the right-click menu) you can find:
Outputs
-------

* **Data:** Mixed data of the incoming data, the length of Outputs depends on the **Data True**, **Data False** and **Mask** list lengths.
* **Data:** Mixed data of the incoming data, the length of Outputs depends on the **Data True**, **Data False** and **Mask** list lengths. If, at the choice level, the node encounters true and false input lists simultaneously empty, the corresponding output is an empty list. If only one of the two is empty, then values chosen from the other by the mask are replaced by None.

Example
-------
Expand Down
7 changes: 6 additions & 1 deletion nodes/list_masks/mask_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ def process(self):

def apply_choice_mask(self, mask, data_t, data_f):
out = []
param = list_match_func[self.list_match_global]([mask, data_t, data_f])
if len(data_t) == 0:
data_t = [None] * len(data_f)
elif len(data_f) == 0:
data_f = [None] * len(data_t)

param = list_match_func[self.list_match_global]([mask, data_t, data_f])
for m, t, f in zip(*param):
if m:
out.append(t)
Expand Down