Commit a225da4b authored by Alexander Kachkaev's avatar Alexander Kachkaev Committed by Tim Neutkens

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

The example does not crash if a user chooses a non-existing language (e.g. goes to localhost:3000/?lng=ru)
parent 0107051e
...@@ -45,7 +45,7 @@ i18n.getInitialProps = (req, namespaces) => { ...@@ -45,7 +45,7 @@ i18n.getInitialProps = (req, namespaces) => {
req.i18n.languages.forEach((l) => { req.i18n.languages.forEach((l) => {
initialI18nStore[l] = {} initialI18nStore[l] = {}
namespaces.forEach((ns) => { namespaces.forEach((ns) => {
initialI18nStore[l][ns] = req.i18n.services.resourceStore.data[l][ns] || {} initialI18nStore[l][ns] = (req.i18n.services.resourceStore.data[l] || {})[ns] || {}
}) })
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment