diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index c8cf4680a..c08f5abdc 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -1817,10 +1817,14 @@ class ServerConfig { /// also see [encode] /// throw when decoding failure ServerConfig.decode(String msg) { - final input = msg.split('').reversed.join(''); - final bytes = base64Decode(base64.normalize(input)); - final json = jsonDecode(utf8.decode(bytes)); - + var json = {}; + try { + json = jsonDecode(msg); + } catch (err) { + final input = msg.split('').reversed.join(''); + final bytes = base64Decode(base64.normalize(input)); + json = jsonDecode(utf8.decode(bytes)); + } idServer = json['host'] ?? ''; relayServer = json['relay'] ?? ''; apiServer = json['api'] ?? '';