diff --git a/src/meshcore/commands/messaging.py b/src/meshcore/commands/messaging.py index dae7936..12cbf49 100644 --- a/src/meshcore/commands/messaging.py +++ b/src/meshcore/commands/messaging.py @@ -73,10 +73,11 @@ class MessagingCommands(CommandHandlerBase): timestamp = int(time.time()) if dst_type is None: - dst_type = dst["type"] - else: # assume destination is a repeater - logger.warning("Can't determine destination type, please ensure contacts first or specify dst_type when calling `send_cmd`. Assuming it's a repeater.") - dst_type = AdvType.REPEATER.value + if isinstance(dst, dict) and "type" in dst: + dst_type = dst["type"] + else: # assume destination is a repeater + logger.warning("Can't determine destination type, please ensure contacts first or specify dst_type when calling `send_cmd`. Assuming it's a repeater.") + dst_type = AdvType.REPEATER.value cmd_data = bytearray([CommandType.SEND_TXT_MSG.value]) if dst_type == AdvType.CHAT.value :