diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-02-09 13:28:13 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:15:02 +0100 |
commit | a8b3b50f456d90e8ea746ec9657ffeec1a0f06bf (patch) | |
tree | 90baebb0d58d696ade5481f7083bcc67ae0a7b92 | |
parent | b61c94016afe8a598f3b7f576430f790c6898a4f (diff) | |
download | ModemManager-a8b3b50f456d90e8ea746ec9657ffeec1a0f06bf.tar.gz |
sms: 'number' and 'text' are mandatory when creating from properties
-rw-r--r-- | src/mm-sms.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mm-sms.c b/src/mm-sms.c index 88a9ad3d7..4209d5695 100644 --- a/src/mm-sms.c +++ b/src/mm-sms.c @@ -650,6 +650,17 @@ mm_sms_new_from_properties (MMBaseModem *modem, { MMSmsPart *part; + /* Don't create SMS from properties if either text or number is missing */ + if (!mm_common_sms_properties_get_text (properties) || + !mm_common_sms_properties_get_number (properties)) { + g_set_error (error, + MM_CORE_ERROR, + MM_CORE_ERROR_INVALID_ARGS, + "Cannot create SMS: mandatory parameter '%s' is missing", + (mm_common_sms_properties_get_text (properties) == NULL ? + "text" : "number")); + } + part = mm_sms_part_new (SMS_PART_INVALID_INDEX); mm_sms_part_set_text (part, mm_common_sms_properties_get_text (properties)); mm_sms_part_set_number (part, mm_common_sms_properties_get_number (properties)); |