Avoid split for undefined objects

This commit is contained in:
Abhishek Goenka 2018-09-05 07:32:45 +05:30
Родитель c8ed5b1c42
Коммит 0de30867dd
1 изменённых файлов: 11 добавлений и 9 удалений

Просмотреть файл

@ -241,6 +241,7 @@ function base64UrlToByteArray(str: string): Uint8Array | undefined {
function splitSerializeName(prop: string): Array<string> { function splitSerializeName(prop: string): Array<string> {
const classes: Array<string> = []; const classes: Array<string> = [];
let partialclass = ""; let partialclass = "";
if (prop) {
const subwords = prop.split("."); const subwords = prop.split(".");
for (const item of subwords) { for (const item of subwords) {
@ -252,6 +253,7 @@ function splitSerializeName(prop: string): Array<string> {
partialclass = ""; partialclass = "";
} }
} }
}
return classes; return classes;
} }
@ -533,7 +535,7 @@ function deserializeCompositeType(serializer: Serializer, mapper: CompositeMappe
const propertyMapper = modelProps[key]; const propertyMapper = modelProps[key];
const { serializedName, xmlName, xmlElementName } = propertyMapper; const { serializedName, xmlName, xmlElementName } = propertyMapper;
let propertyObjectName = objectName; let propertyObjectName = objectName;
if (serializedName !== "") { if (serializedName !== "" && serializedName !== undefined) {
propertyObjectName = objectName + "." + serializedName; propertyObjectName = objectName + "." + serializedName;
} }