From 910ca26ab30cd7d9886c74f6cfca5d3822d7ac34 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 17 May 2021 10:38:09 -0700 Subject: [PATCH] Fix for #2631 --- MeshCentralServer.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/MeshCentralServer.cs b/MeshCentralServer.cs index a33bc91..d1a50b9 100644 --- a/MeshCentralServer.cs +++ b/MeshCentralServer.cs @@ -556,7 +556,20 @@ namespace MeshCentralRouter if (node["mtype"].GetType() == typeof(string)) { n.mtype = int.Parse((string)node["mtype"]); } if (node["mtype"].GetType() == typeof(int)) { n.mtype = (int)node["mtype"]; } } - if (node.ContainsKey("users")) { n.users = (string[])((ArrayList)node["users"]).ToArray(typeof(string)); } else { n.users = null; } + if (node.ContainsKey("users")) { + if (node["users"].GetType() == typeof(ArrayList)) { + n.users = (string[])((ArrayList)node["users"]).ToArray(typeof(string)); + } else if (node["users"].GetType() == typeof(Dictionary)) { + Dictionary users = (Dictionary)node["users"]; + ArrayList users2 = new ArrayList(); + foreach (string u in users.Keys) { if (users[u].GetType() == typeof(string)) { users2.Add((string)users[u]); } } + n.users = (string[])users2.ToArray(typeof(string)); + } else { + n.users = null; + } + } else { + n.users = null; + } if (node.ContainsKey("rdpport")) { n.rdpport = (int)node["rdpport"]; } else { n.rdpport = 3389; } if (node.ContainsKey("conn")) { n.conn = (int)node["conn"]; } else { n.conn = 0; } if (node.ContainsKey("icon")) { n.icon = (int)node["icon"]; }