Skip to content

Commit cff200d

Browse files
committed
JI-1069 Fix crashing when changing language in BSEditor
1 parent dc35a60 commit cff200d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

scripts/h5peditor-form.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,16 @@ ns.Form = function (library, startLanguages, defaultLanguage) {
149149
}
150150
if (semantics[i].fields !== undefined && semantics[i].fields.length &&
151151
translation[i].fields !== undefined && translation[i].fields.length) {
152-
findFieldDefaultTranslation(field, semantics[i].fields, translation[i].fields);
152+
const found1 = findFieldDefaultTranslation(field, semantics[i].fields, translation[i].fields);
153+
if (found1 !== undefined) {
154+
return found1;
155+
}
153156
}
154157
if (semantics[i].field !== undefined && translation[i].field !== undefined) {
155-
findFieldDefaultTranslation(field, [semantics[i].field], [translation[i].field]);
158+
const found2 = findFieldDefaultTranslation(field, [semantics[i].field], [translation[i].field]);
159+
if (found2 !== undefined) {
160+
return found2;
161+
}
156162
}
157163
}
158164
};
@@ -194,7 +200,7 @@ ns.Form = function (library, startLanguages, defaultLanguage) {
194200
// Figure out what we actually need to load
195201
const loadLibs = [];
196202
for (let li in ns.libraryCache) {
197-
if (ns.libraryCache[li].translation[lang] === undefined) {
203+
if (ns.libraryCache[li] === 0 || ns.libraryCache[li].translation[lang] === undefined) {
198204
loadLibs.push(li);
199205
}
200206
}

0 commit comments

Comments
 (0)