Skip to content

Commit

Permalink
fixes UUID when account UUID is already present but not valid
Browse files Browse the repository at this point in the history
  • Loading branch information
1zun4 committed Dec 12, 2023
1 parent cdbb48a commit 10aee67
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src-tauri/src/app/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::{sync::{Arc, Mutex}, thread};

use tracing::{error, info, debug};
use tauri::{Manager, Window};
use uuid::Uuid;

use crate::{LAUNCHER_DIRECTORY, minecraft::{launcher::{LauncherData, LaunchingParameter}, prelauncher, progress::ProgressUpdate, auth::{MinecraftAccount, self}}, HTTP_CLIENT};
use crate::app::api::{Branches, Changelog, ContentDelivery, News};
Expand Down Expand Up @@ -131,7 +132,16 @@ async fn run_client(build_id: u32, account_data: MinecraftAccount, options: Laun

let (account_name, uuid, token, user_type) = match account_data {
MinecraftAccount::MsaAccount { name, uuid, token, .. } => (name, uuid, token, "msa".to_string()),
MinecraftAccount::OfflineAccount { name, uuid } => (name, uuid, "-".to_string(), "legacy".to_string())
MinecraftAccount::OfflineAccount { name, uuid } => {
// A UUID of length less than 2 is invalid, so we generate a new one
let uuid = if uuid.len() < 2 {
Uuid::new_v4().to_string()
} else {
uuid
};

(name, uuid, "-".to_string(), "legacy".to_string())
}
};

let parameters = LaunchingParameter {
Expand Down

0 comments on commit 10aee67

Please sign in to comment.