Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Commit

Permalink
fix(): fix npe on empty strings (trim())
Browse files Browse the repository at this point in the history
solves #435
solves again #281, #281, #298
  • Loading branch information
knalli authored and 0x-r4bbit committed Apr 22, 2014
1 parent 3c54a77 commit c69de7b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/service/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,9 @@ angular.module('pascalprecht.translate').provider('$translate', ['$STORAGE_KEY',
var deferred = $q.defer();

// trim off any whitespace
translationId = translationId.trim();
if (translationId) {
translationId = translationId.trim();
}

var promiseToWaitFor = (function () {
var promise = $preferredLanguage ?
Expand Down Expand Up @@ -1523,7 +1525,10 @@ angular.module('pascalprecht.translate').provider('$translate', ['$STORAGE_KEY',
return translationId;
}

translationId = translationId.trim();
// trim off any whitespace
if (translationId) {
translationId = translationId.trim();
}

var result, possibleLangKeys = [];
if ($preferredLanguage) {
Expand Down

0 comments on commit c69de7b

Please sign in to comment.