summaryrefslogtreecommitdiffstats
path: root/src/simfs.c
diff options
context:
space:
mode:
authorGuillaume Lucas <guillaumex.lucas@intel.com>2011-03-09 12:32:23 +0000
committerDenis Kenzior <denkenz@gmail.com>2011-03-11 14:57:31 -0600
commit4ff9cf9a27d4d3f497ce7de70db0576156b4f350 (patch)
tree1ce43fbe56ffa7f0ac95ed3273f05144007e982f /src/simfs.c
parenta8bdb87c109960f2b4eecaece0de2329b087790d (diff)
downloadofono-4ff9cf9a27d4d3f497ce7de70db0576156b4f350.tar.bz2
simfs: fix GLib-CRITICAL warning
During modem release, when there is no SIM card, a GLib-CRITICAL issue occurs during the free of the sim fs context.
Diffstat (limited to 'src/simfs.c')
-rw-r--r--src/simfs.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/simfs.c b/src/simfs.c
index 3a97a10c..49f79dd5 100644
--- a/src/simfs.c
+++ b/src/simfs.c
@@ -166,21 +166,23 @@ void sim_fs_context_free(struct ofono_sim_context *context)
int n = 0;
struct sim_fs_op *op;
- while ((op = g_queue_peek_nth(fs->op_q, n)) != NULL) {
- if (op->context != context) {
- n += 1;
- continue;
- }
+ if (fs->op_q) {
+ while ((op = g_queue_peek_nth(fs->op_q, n)) != NULL) {
+ if (op->context != context) {
+ n += 1;
+ continue;
+ }
- if (n == 0) {
- op->cb = NULL;
+ if (n == 0) {
+ op->cb = NULL;
- n += 1;
- continue;
- }
+ n += 1;
+ continue;
+ }
- sim_fs_op_free(op);
- g_queue_remove(fs->op_q, op);
+ sim_fs_op_free(op);
+ g_queue_remove(fs->op_q, op);
+ }
}
if (context->file_watches)