Skip to content

Commit 2f6863b

Browse files
hoangnt2heliocastro
authored andcommitted
fix(Common): Handle null and undefined case for convertObjectToMapRoles
1 parent e996799 commit 2f6863b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/utils/common.utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ const convertObjectToMap = (data: { [k: string]: string }): InputKeyValue[] => {
123123
* @param data - The object to convert.
124124
* @returns An array of key-value pairs.
125125
*/
126-
const convertObjectToMapRoles = (data: { [k: string]: Array<string> }): InputKeyValue[] => {
126+
const convertObjectToMapRoles = (data: { [k: string]: Array<string> } | null | undefined): InputKeyValue[] => {
127+
if (isNullOrUndefined(data))
128+
return []
127129
const inputRoles: InputKeyValue[] = []
128130
const mapRoles = new Map(Object.entries(data))
129131
mapRoles.forEach((value, key) => {

0 commit comments

Comments
 (0)