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 empty YAML file causing crash with latest js-yaml #123

Merged
merged 2 commits into from
Jul 22, 2014
Merged

Fix empty YAML file causing crash with latest js-yaml #123

merged 2 commits into from
Jul 22, 2014

Conversation

roncli
Copy link
Contributor

@roncli roncli commented Jul 22, 2014

When tracking configuration sources, an assumption is made that configObject is going to always be an object. With the latest js-yaml, this assumption is no longer true, as an empty YAML file will return undefined when parsed.

Attempting to serialize undefined into a JSON string by using JSON.stringify() is legal, also returning undefined. However, attempting to get the length property of undefined is an error.

This request eliminates this assumption by ensuring that configObject is actually an object before attempting to get the length of the serialized object.

lorenwest added a commit that referenced this pull request Jul 22, 2014
Fix empty YAML file causing crash with latest js-yaml
@lorenwest lorenwest merged commit 1c6346b into node-config:master Jul 22, 2014
@lorenwest
Copy link
Collaborator

Thank you for this update. It comes very timely as I intend to publish 1.0 to NPM later today. I will also merge this change into the 0.4 branch so those not wishing to upgrade to 1.0 can benefit.

Cheers,
-Loren

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

2 participants