Correct check that a translation is an object

typeof translation === 'object' returns true when translation is null
This commit is contained in:
Toby Zerner 2015-09-04 12:19:02 +09:30
parent 5e1978ceb7
commit ff993c99a4

View File

@ -51,7 +51,7 @@ export default class Translator {
// If this translation has multiple options and a 'count' has been provided
// in the input, we'll work out which option to choose using the `plural`
// method.
if (typeof translation === 'object' && typeof input.count !== 'undefined') {
if (translation && typeof translation === 'object' && typeof input.count !== 'undefined') {
translation = translation[this.plural(extractText(input.count))];
}