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

Code hardening to deal with null/undefined files object #69

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rainabba
Copy link

As part of a form reset, I had set my bound files object to be null. This code assumed files to be a valid array (which would then have .map() on it) so I added logic to short-circuit onFileChanged() if files is null/undefined or doesn't have .map on it.

If the files object is set to null/undefined, the call to .map throws an unhanded exception, but it shouldn't be called anyway if files isn't a valid array. This patch accounts for that possibility.
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.

None yet

1 participant