Skip to content

Commit 83aa1fb

Browse files
committed
Added data === 'object' to check if data is an object before parsing
the content. This avoid parsing data that is not useful, like in situations where pinging a file that doesn’t exist return index.html.
1 parent 98de893 commit 83aa1fb

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/catalog.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,10 @@ angular.module('gettext').factory('gettextCatalog', function (gettextPlurals, $h
109109
url: url,
110110
cache: catalog.cache
111111
}).success(function (data) {
112-
for (var lang in data) {
113-
catalog.setStrings(lang, data[lang]);
112+
if (typeof data === 'object') {
113+
for (var lang in data) {
114+
catalog.setStrings(lang, data[lang]);
115+
}
114116
}
115117
});
116118
}

0 commit comments

Comments
 (0)