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

Fix: Add null check for Select field options in fields_layout #407

Merged
merged 1 commit into from
Oct 11, 2024

Conversation

pu-raihan
Copy link
Contributor

Changes:

  • Added a null check (and field.options) in the condition to handle cases where options are empty or undefined for "Select" type fields.

Why is this needed?

When I added a custom field of type Select without options, then code attempted to split field.options without checking if it existed, which could result in errors when field.options is None or an empty string which resulted in error and not loading all the fields after that field. By adding this check, we ensure that the code only attempts to split the options when field.options has a value.

Code Changes:

if field.fieldtype == "Select" and field.options:
    field.options = field.options.split("\n")

### Reproduce Issue:
Try creating a select field without options and then add it in sections field layout. then if you try to edit the layout it will cause the error and some of the fields (fields shown after the new field) will not show up

@shariquerik shariquerik merged commit 83d5b33 into frappe:develop Oct 11, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants