Skip to content

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

Open
rainabba wants to merge 2 commits intoshuyu:masterfrom
rainabba:develop
Open

Code hardening to deal with null/undefined files object#69
rainabba wants to merge 2 commits intoshuyu:masterfrom
rainabba:develop

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.

1 participant