MOBILE-3201 libs: Fix sortProperties null object error

main
Pau Ferrer Ocaña 2019-12-09 11:32:42 +01:00
parent c94c319225
commit b4f563282b
1 changed files with 1 additions and 1 deletions

View File

@ -1252,7 +1252,7 @@ export class CoreUtilsProvider {
* @return Sorted object. * @return Sorted object.
*/ */
sortProperties(obj: object): object { sortProperties(obj: object): object {
if (typeof obj == 'object' && !Array.isArray(obj)) { if (obj != null && typeof obj == 'object' && !Array.isArray(obj)) {
// It's an object, sort it. // It's an object, sort it.
return Object.keys(obj).sort().reduce((accumulator, key) => { return Object.keys(obj).sort().reduce((accumulator, key) => {
// Always call sort with the value. If it isn't an object, the original value will be returned. // Always call sort with the value. If it isn't an object, the original value will be returned.