Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Check if the factoryFor ember-i18n@config:zh is null before accessing it
Browse files Browse the repository at this point in the history
  • Loading branch information
xm committed Mar 31, 2017
1 parent 2d67b47 commit 033fbe1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion addon/utils/locale.js
Expand Up @@ -29,7 +29,14 @@ Locale.prototype = {
if (this.rtl === undefined) { this.rtl = config.rtl; }
if (this.pluralForm === undefined) { this.pluralForm = config.pluralForm; }
});
let defaultConfig = this.owner.factoryFor('ember-i18n@config:zh').class;

// Exit early if we already have an RTL and pluralForm config set
if (this.rtl !== undefined && this.pluralForm !== undefined) {
return;
}

let defaultConfigFactory = this.owner.factoryFor('ember-i18n@config:zh');
let defaultConfig = defaultConfigFactory ? defaultConfigFactory.class : null;

if (this.rtl === undefined) {
warn(`ember-i18n: No RTL configuration found for ${this.id}.`, false, { id: 'ember-i18n.no-rtl-configuration' });
Expand Down

0 comments on commit 033fbe1

Please sign in to comment.