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 null pointer exception in with-react-18next #3944

Merged
merged 1 commit into from
Mar 6, 2018
Merged

Fix null pointer exception in with-react-18next #3944

merged 1 commit into from
Mar 6, 2018

Conversation

kachkaev
Copy link
Contributor

@kachkaev kachkaev commented Mar 6, 2018

The example no longer crashes when a user chooses a non-existing language (e.g. goes to localhost:3000/?lng=ru)

Before this PR:

TypeError: Cannot read property 'home' of undefined
    at /private/tmp/next.js/examples/with-react-i18next/i18n.js:48:33
    at Array.forEach (<anonymous>)
    at forEach (/private/tmp/next.js/examples/with-react-i18next/i18n.js:47:16)
    at Array.forEach (<anonymous>)
    at I18n.forEach [as getInitialProps] (/private/tmp/next.js/examples/with-react-i18next/i18n.js:45:22)
    at Object.getInitialProps (/private/tmp/next.js/examples/with-react-i18next/lib/withI18next.js:15:42)
    at tryCatch (/private/tmp/next.js/examples/with-react-i18next/node_modules/regenerator-runtime/runtime.js:62:40)

After this PR: the page uses fallback language (i.e. en).

cc @jamuhl

The example does not crash if a user chooses a non-existing language (e.g. goes to localhost:3000/?lng=ru)
@timneutkens timneutkens merged commit a225da4 into vercel:canary Mar 6, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Mar 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants