iface-modem-messaging: check if supported storage is allocated before use
load_supported_storages may fail, which results in unallocated storage memory. This patch modifies load_initial_sms_parts_from_storages and is_storage_supported to handle that gracefully.
This commit is contained in:
committed by
Aleksander Morgado
parent
431b6a0fc5
commit
717977d0b5
@@ -377,9 +377,11 @@ is_storage_supported (GArray *supported,
|
||||
if (preferred == MM_SMS_STORAGE_UNKNOWN)
|
||||
return TRUE;
|
||||
|
||||
for (i = 0; i < supported->len; i++) {
|
||||
if (preferred == g_array_index (supported, MMSmsStorage, i))
|
||||
return TRUE;
|
||||
if (supported) {
|
||||
for (i = 0; i < supported->len; i++) {
|
||||
if (preferred == g_array_index (supported, MMSmsStorage, i))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
g_set_error (error,
|
||||
@@ -761,7 +763,7 @@ load_initial_sms_parts_from_storages (EnablingContext *ctx)
|
||||
|
||||
storage_ctx = get_storage_context (ctx->self);
|
||||
|
||||
if (ctx->mem1_storage_index >= storage_ctx->supported_mem1->len)
|
||||
if (!storage_ctx->supported_mem1 || ctx->mem1_storage_index >= storage_ctx->supported_mem1->len)
|
||||
all_loaded = TRUE;
|
||||
/* We'll skip the 'MT' storage, as that is a combination of 'SM' and 'ME' */
|
||||
else if (g_array_index (storage_ctx->supported_mem1,
|
||||
|
||||
Reference in New Issue
Block a user