Skip to content

Commit b3f6999

Browse files
committed
Fix project export error when no project QP
1 parent 7cc099f commit b3f6999

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sonar/utilities.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,8 @@ def dict_remap_and_stringify(original_dict: dict[str, str], remapping: dict[str,
732732

733733
def list_to_dict(original_list: list[dict[str, Any]], key_field: str) -> dict[str, any]:
734734
"""Converts a list to dict with list key_field as dict key"""
735+
if original_list is None:
736+
return original_list
735737
converted_dict = {elem[key_field]: elem for elem in original_list}
736738
for e in converted_dict.values():
737739
e.pop(key_field)
@@ -740,7 +742,7 @@ def list_to_dict(original_list: list[dict[str, Any]], key_field: str) -> dict[st
740742

741743
def dict_to_list(original_dict: dict[str, Any], key_field: str, value_field: Optional[str] = "value") -> list[str, any]:
742744
"""Converts a dict to list adding dict key in list key_field"""
743-
if isinstance(original_dict, list):
745+
if original_dict is None or isinstance(original_dict, list):
744746
return original_dict
745747
return [{key_field: key, value_field: elem} if not isinstance(elem, dict) else {key_field: key, **elem} for key, elem in original_dict.items()]
746748

0 commit comments

Comments
 (0)