[polari/fix-82] networksManager: Only include charset when it is defined



commit bf2bb671e2c388c41bdd1648c378972e036dae61
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Oct 22 17:41:54 2018 +0200

    networksManager: Only include charset when it is defined
    
    All network details must be valid GVariants, so only include optional
    information when it is available instead of adding it as undefined.
    
    https://gitlab.gnome.org/GNOME/polari/issues/82

 src/networksManager.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/networksManager.js b/src/networksManager.js
index ea620e3..fd77d7c 100644
--- a/src/networksManager.js
+++ b/src/networksManager.js
@@ -77,13 +77,17 @@ var NetworksManager = class {
             throw new Error(`No servers for network ${id}`);
 
         let server = this.getNetworkServers(id)[0];
-        return {
+        let details = {
             'account': new GLib.Variant('s', GLib.get_user_name()),
             'server': new GLib.Variant('s', server.address),
             'port': new GLib.Variant('u', server.port),
             'use-ssl': new GLib.Variant('b', server.ssl),
-            'charset': server.charset ? new GLib.Variant('s', server.charset) : undefined
         };
+
+        if (server.charset)
+            details['charset'] = new GLib.Variant('s', server.charset);
+
+        return details;
     }
 
     getNetworkServers(id) {


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