libmbim-glib,device: fix segfault when cancellable already cancelled

The g_cancellable_connect() method will also call the given callback
when the input cancellable is already cancelled. This means that the
cancellation callback should also handle the case where the transaction
hasn't been stored in the tracking table yet.

Thanks to BenoƮt Donnette <benoit.donnette@21net.com> for the report and
the suggested fix.

This is the port of the same bugfix from libqmi, see:
https://bugs.freedesktop.org/show_bug.cgi?id=98283
diff --git a/src/libmbim-glib/mbim-device.c b/src/libmbim-glib/mbim-device.c
index a001940..961e79e 100644
--- a/src/libmbim-glib/mbim-device.c
+++ b/src/libmbim-glib/mbim-device.c
@@ -309,6 +309,12 @@
                                      ctx->type,
                                      MBIM_MESSAGE_TYPE_INVALID,
                                      ctx->transaction_id);
+
+    /* The transaction may have already been cancelled before we stored it in
+     * the tracking table */
+    if (!tr)
+        return;
+
     tr->cancellable_id = 0;
 
     /* Complete transaction with an abort error */
@@ -346,6 +352,8 @@
     }
 
     if (tr->cancellable && !tr->cancellable_id) {
+        /* Note: transaction_cancelled() will also be called directly if the
+         * cancellable is already cancelled */
         tr->cancellable_id = g_cancellable_connect (tr->cancellable,
                                                     (GCallback)transaction_cancelled,
                                                     tr->wait_ctx,