[vala/wip/transform: 99/102] GDBus: Handle fd_list being null



commit d89e1fab728381590f3bd26abc890fbdd2a0f8f8
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sun Mar 19 23:14:10 2017 +0100

    GDBus: Handle fd_list being null

 codegen/valagdbusclienttransformer.vala | 1 +
 codegen/valagdbusservertransformer.vala | 4 ++++
 2 files changed, 5 insertions(+)
---
diff --git a/codegen/valagdbusclienttransformer.vala b/codegen/valagdbusclienttransformer.vala
index 2f006cfbe..81dec84d8 100644
--- a/codegen/valagdbusclienttransformer.vala
+++ b/codegen/valagdbusclienttransformer.vala
@@ -52,6 +52,7 @@ public class Vala.GDBusClientTransformer : GVariantTransformer {
                                fd_index = b.add_temp_declaration (null, expression ("0"));
                                statements (@"$fd_list = $message.get_unix_fd_list ();");
                        }
+                       statements (@"if ($fd_list == null) { throw new GLib.IOError.FAILED (\"FD List is 
NULL\"); }");
                        statements (@"$iter.next (\"h\", out $fd_index);");
                        if (type_name == "GLib.UnixInputStream") {
                                return expression (@"new GLib.UnixInputStream ($fd_list.get ($fd_index), 
true)");
diff --git a/codegen/valagdbusservertransformer.vala b/codegen/valagdbusservertransformer.vala
index ba03293c8..82655d188 100644
--- a/codegen/valagdbusservertransformer.vala
+++ b/codegen/valagdbusservertransformer.vala
@@ -85,7 +85,11 @@ public class Vala.GDBusServerTransformer : GDBusClientTransformer {
 
                        if (param.direction == ParameterDirection.IN) {
                                var arg = b.add_temp_declaration (copy_type (param.variable_type, true));
+                               b.open_try ();
                                b.add_assignment (expression (arg), read_dbus_value (param.variable_type, 
iter, "invocation.get_message ()", ref fd_list, ref fd_index));
+                               b.add_catch_all ("_invocation_gerror_");
+                               statements ("invocation.return_gerror (_invocation_gerror_); return;");
+                               b.close ();
                                call.add_argument (expression (arg));
                        } else if (param.direction == ParameterDirection.OUT) {
                                if (m.coroutine) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]