From ee9e7949b77ffbe2f61acb178b2b270ab80aff10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=EC=84=B8=EC=9D=B8?= Date: Sun, 7 Nov 2021 18:38:41 +0900 Subject: [PATCH] clean code --- CmlLib/Core/Auth/Microsoft/XboxMinecraftLogin.cs | 3 ++- CmlLib/Core/Launcher/MLaunch.cs | 1 - CmlLib/Core/Launcher/MNative.cs | 4 +--- CmlLib/Core/MojangLauncher/MojangLauncherAccounts.cs | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/CmlLib/Core/Auth/Microsoft/XboxMinecraftLogin.cs b/CmlLib/Core/Auth/Microsoft/XboxMinecraftLogin.cs index 9bdd3a3..aceb74d 100644 --- a/CmlLib/Core/Auth/Microsoft/XboxMinecraftLogin.cs +++ b/CmlLib/Core/Auth/Microsoft/XboxMinecraftLogin.cs @@ -38,7 +38,8 @@ public AuthenticationResponse LoginWithXbox(string uhs, string xstsToken) var res = req.GetResponse(); var resBody = readRes(res); - var obj = JsonConvert.DeserializeObject(resBody); + var obj = JsonConvert.DeserializeObject(resBody) + ?? new AuthenticationResponse(); obj.ExpiresOn = DateTime.Now.AddSeconds(obj.ExpiresIn); return obj; } diff --git a/CmlLib/Core/Launcher/MLaunch.cs b/CmlLib/Core/Launcher/MLaunch.cs index 8d0ceb9..096ccd5 100644 --- a/CmlLib/Core/Launcher/MLaunch.cs +++ b/CmlLib/Core/Launcher/MLaunch.cs @@ -3,7 +3,6 @@ using System.Diagnostics; using System.IO; using System.Linq; -using CmlLib.Core.Auth; using CmlLib.Core.Version; namespace CmlLib.Core diff --git a/CmlLib/Core/Launcher/MNative.cs b/CmlLib/Core/Launcher/MNative.cs index ab6247d..4a82804 100644 --- a/CmlLib/Core/Launcher/MNative.cs +++ b/CmlLib/Core/Launcher/MNative.cs @@ -1,6 +1,4 @@ -using System; -using System.Diagnostics; -using CmlLib.Core.Version; +using CmlLib.Core.Version; using CmlLib.Utils; using System.IO; diff --git a/CmlLib/Core/MojangLauncher/MojangLauncherAccounts.cs b/CmlLib/Core/MojangLauncher/MojangLauncherAccounts.cs index e356f7d..0aeb8eb 100644 --- a/CmlLib/Core/MojangLauncher/MojangLauncherAccounts.cs +++ b/CmlLib/Core/MojangLauncher/MojangLauncherAccounts.cs @@ -49,7 +49,7 @@ public static MojangLauncherAccounts FromFile(string path) return FromJSON(content); } - public static MojangLauncherAccounts FromJSON(string json) + public static MojangLauncherAccounts? FromJSON(string json) { return JsonConvert.DeserializeObject(json); }