Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit ababd8c

Browse files
zwegerZack Weger
andauthored
Ensure that OpenCTIConnectorHelper.get_state always returns a dictionary as required (#137)
Co-authored-by: Zack Weger <[email protected]>
1 parent 1f8414d commit ababd8c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pycti/connector/opencti_connector_helper.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,13 @@ def get_state(self):
351351
"""
352352

353353
try:
354-
return (
355-
None
356-
if self.connector_state is None
357-
else json.loads(self.connector_state)
358-
)
354+
if self.connector_state:
355+
state = json.loads(self.connector_state)
356+
if isinstance(state, dict) and state:
357+
return state
359358
except:
360-
return None
359+
pass
360+
return None
361361

362362
def listen(self, message_callback: Callable[[str, Dict], str]) -> None:
363363
"""listen for messages and register callback function

0 commit comments

Comments
 (0)